Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mooc-rr-ressources
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Learning Lab
mooc-rr-ressources
Commits
fa518547
Commit
fa518547
authored
Sep 05, 2018
by
Arnaud Legrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the text on pip + information on R installed packages
parent
9df89c7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
10 deletions
+36
-10
resources.org
module4/ressources/resources.org
+36
-10
No files found.
module4/ressources/resources.org
View file @
fa518547
...
@@ -83,7 +83,11 @@ hash) will not be stored in the cell. This is not really a problem and
...
@@ -83,7 +83,11 @@ hash) will not be stored in the cell. This is not really a problem and
is
the
price
to
pay
for
running
git
from
within
the
notebook
itself
.
is
the
price
to
pay
for
running
git
from
within
the
notebook
itself
.
*
Getting
information
about
Python
(
3
)
libraries
*
Getting
information
about
Python
(
3
)
libraries
**
Getting
the
list
of
installed
packages
and
their
version
**
Getting
the
list
of
installed
packages
and
their
version
https
://
stackoverflow
.
com
/
questions
/
20180543
/
how
-
to
-
check
-
version
-
of
-
python
-
modules
This
topic
is
discussed
on
[[
https
://
stackoverflow
.
com
/
questions
/
20180543
/
how
-
to
-
check
-
version
-
of
-
python
-
modules
][
StackOverflow
]].
When
using
=
pip
=
(
the
Python
package
installer
)
within
a
shell
command
,
it
is
easy
to
query
the
version
of
all
installed
packages
(
note
that
on
your
system
,
you
may
have
to
use
either
=
pip
=
or
=
pip3
=
depending
on
how
it
is
named
and
which
versions
of
Python
are
available
on
your
machine
.
#+
begin_src
shell
:
results
output
:
exports
both
#+
begin_src
shell
:
results
output
:
exports
both
pip3
freeze
pip3
freeze
#+
end_src
#+
end_src
...
@@ -109,6 +113,10 @@ wcwidth==0.1.7
...
@@ -109,6 +113,10 @@ wcwidth==0.1.7
webencodings
==
0.5
webencodings
==
0.5
#+
end_example
#+
end_example
Once
you
know
which
packages
are
installed
,
you
can
easily
get
additional
information
about
a
given
package
and
in
particular
check
whether
it
was
installed
"locally"
through
pip
or
whether
it
is
installed
system
-
wide
.
Again
,
in
a
shell
command
:
#+
begin_src
shell
:
results
output
:
exports
both
#+
begin_src
shell
:
results
output
:
exports
both
pip3
show
pandas
pip3
show
pandas
echo
" "
echo
" "
...
@@ -138,14 +146,12 @@ Location: /home/alegrand/.local/lib/python3.6/site-packages
...
@@ -138,14 +146,12 @@ Location: /home/alegrand/.local/lib/python3.6/site-packages
Requires
:
patsy
,
pandas
Requires
:
patsy
,
pandas
#+
end_example
#+
end_example
#+
begin_src
python
:
results
output
:
exports
both
#+
end_src
**
How
to
list
imported
modules
?
**
How
to
list
imported
modules
?
Inspiring
from
[[
https
://
stackoverflow
.
com
/
questions
/
4858100
/
how
-
to
-
list
-
imported
-
modules
][
StackOverflow
]],
here
is
a
simple
function
that
lists
Without
resorting
to
pip
(
that
will
list
all
available
packages
),
you
loaded
package
(
that
have
a
=
__version__
=
attribute
,
which
is
may
want
to
know
which
modules
are
loaded
in
a
Python
session
as
well
unfortunately
not
completely
standard
).
as
their
version
.
Inspiring
from
[[
https
://
stackoverflow
.
com
/
questions
/
4858100
/
how
-
to
-
list
-
imported
-
modules
][
StackOverflow
]],
here
is
a
simple
function
that
lists
loaded
package
(
that
have
a
=
__version__
=
attribute
,
which
is
unfortunately
not
completely
standard
).
#+
begin_src
python
:
results
output
:
exports
both
#+
begin_src
python
:
results
output
:
exports
both
def
print_imported_modules
():
def
print_imported_modules
():
...
@@ -204,9 +210,9 @@ pip3 freeze > requirements.txt # to obtain the list of packages with their versi
...
@@ -204,9 +210,9 @@ pip3 freeze > requirements.txt # to obtain the list of packages with their versi
pip3
install
-
r
requirements
.
txt
#
to
install
the
previous
list
of
packages
,
possibly
on
an
other
machine
pip3
install
-
r
requirements
.
txt
#
to
install
the
previous
list
of
packages
,
possibly
on
an
other
machine
#+
end_src
#+
end_src
If
you
want
to
have
several
installed
p
ython
environments
,
you
may
If
you
want
to
have
several
installed
P
ython
environments
,
you
may
want
to
use
[[
https
://
docs
.
pipenv
.
org
/][
Pipenv
]].
I
doubt
it
allows
to
track
correctly
FORTRAN
or
C
want
to
use
[[
https
://
docs
.
pipenv
.
org
/][
Pipenv
]].
I
doubt
it
allows
to
track
correctly
FORTRAN
or
C
dynamic
libraries
that
are
wrapped
by
Python
.
dynamic
libraries
that
are
wrapped
by
Python
though
.
*
Getting
information
about
R
libraries
*
Getting
information
about
R
libraries
The
best
way
seems
to
be
to
rely
on
the
=
devtools
=
package
.
The
best
way
seems
to
be
to
rely
on
the
=
devtools
=
package
.
...
@@ -267,3 +273,23 @@ Packages ----------------------------------------------------------------------
...
@@ -267,3 +273,23 @@ Packages ----------------------------------------------------------------------
Some
actually
advocate
that
[[
https
://
github
.
com
/
ropensci
/
rrrpkg
][
writing
a
reproducible
research
compendium
Some
actually
advocate
that
[[
https
://
github
.
com
/
ropensci
/
rrrpkg
][
writing
a
reproducible
research
compendium
can
be
done
by
writing
an
R
package
]].
Those
of
you
willing
to
have
a
can
be
done
by
writing
an
R
package
]].
Those
of
you
willing
to
have
a
clean
R
dependency
management
should
thus
have
a
look
at
[[
https
://
rstudio
.
github
.
io
/
packrat
/][
Packrat
]].
clean
R
dependency
management
should
thus
have
a
look
at
[[
https
://
rstudio
.
github
.
io
/
packrat
/][
Packrat
]].
Finally
,
it
is
good
to
know
that
there
is
a
built
-
in
R
command
(=
installed
.
packages
=)
allowing
to
retrieve
and
list
the
details
of
all
packages
installed
.
#+
begin_src
R
:
results
table
:
session
*
R
*
:
exports
both
:
colnames
yes
head
(
installed
.
packages
())
#+
end_src
#+
RESULTS
:
|
Package
|
LibPath
|
Version
|
Priority
|
Depends
|
Imports
|
LinkingTo
|
Suggests
|
Enhances
|
License
|
License_is_FOSS
|
License_restricts_use
|
OS_type
|
MD5sum
|
NeedsCompilation
|
Built
|
|
|-------------------------------------------------------------+-------------------------------------------------+---------------------------------------------------------+-------------+----------------------------------------------------------+----------------------------------------------------------------+-----------+---------------+---------------------------------------+---------------------------+---------------+---------------------+--------+--------+------------------+-------+-------|
|
BH
|
/
home
/
alegrand
/
R
/
x86_64
-
pc
-
linux
-
gnu
-
library
/
3.5
|
1.66.0
-
1
|
nil
|
nil
|
nil
|
nil
|
nil
|
nil
|
BSL
-
1.0
|
nil
|
nil
|
nil
|
nil
|
no
|
3.5.1
|
|
|
Formula
|
/
home
/
alegrand
/
R
/
x86_64
-
pc
-
linux
-
gnu
-
library
/
3.5
|
1.2
-
3
|
nil
|
R
(>=
2.0.0
),
stats
|
nil
|
nil
|
nil
|
nil
|
GPL
-
2
|
GPL
-
3
|
nil
|
nil
|
nil
|
nil
|
no
|
3.5.1
|
|
Hmisc
|
/
home
/
alegrand
/
R
/
x86_64
-
pc
-
linux
-
gnu
-
library
/
3.5
|
4.1
-
1
|
nil
|
lattice
,
survival
(>=
2.40
-
1
),
Formula
,
ggplot2
(>=
2.2
)
|
methods
,
latticeExtra
,
cluster
,
rpart
,
nnet
,
acepack
,
foreign
,
|
|
|
|
|
|
|
|
|
|
|
|
|
gtable
,
grid
,
gridExtra
,
data
.
table
,
htmlTable
(>=
1.11.0
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
viridis
,
htmltools
,
base64enc
|
nil
|
chron
,
rms
,
mice
,
tables
,
knitr
,
ff
,
ffbase
,
plotly
(>=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4.5.6
)
|
nil
|
GPL
(>=
2
)
|
nil
|
nil
|
nil
|
nil
|
yes
|
3.5.1
|
|
|
|
|
|
|
|
|
|
Matrix
|
/
home
/
alegrand
/
R
/
x86_64
-
pc
-
linux
-
gnu
-
library
/
3.5
|
1.2
-
14
|
recommended
|
R
(>=
3.2.0
)
|
methods
,
graphics
,
grid
,
stats
,
utils
,
lattice
|
nil
|
expm
,
MASS
|
MatrixModels
,
graph
,
SparseM
,
sfsmisc
|
GPL
(>=
2
)
|
file
LICENCE
|
nil
|
nil
|
nil
|
nil
|
yes
|
3.5.1
|
|
StanHeaders
|
/
home
/
alegrand
/
R
/
x86_64
-
pc
-
linux
-
gnu
-
library
/
3.5
|
2.17.2
|
nil
|
nil
|
nil
|
nil
|
RcppEigen
,
BH
|
nil
|
BSD_3_clause
+
file
LICENSE
|
nil
|
nil
|
nil
|
nil
|
yes
|
3.5.1
|
|
|
acepack
|
/
home
/
alegrand
/
R
/
x86_64
-
pc
-
linux
-
gnu
-
library
/
3.5
|
1.4.1
|
nil
|
nil
|
nil
|
nil
|
testthat
|
nil
|
MIT
+
file
LICENSE
|
nil
|
nil
|
nil
|
nil
|
yes
|
3.5.1
|
|
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment