lib
lib

Reputation: 2956

Print packages, without dependecies, in conda environment

Is it possible to print only "top-level" packages, without dependencies, in a conda environment? I am only prototyping stuff, at this point I am more interested in portability than to "freeze"

For example, if I do on my win 7 machine

conda create -n simple_env jupyter 
activate jupyter
conda list -e 

I would like to get as my package list only jupyter , but what I get is a list of everything, with their exact version, platform-specific:

# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: win-64
backports=1.0=py27_0
backports_abc=0.4=py27_0
configparser=3.5.0b2=py27_1
decorator=4.0.10=py27_0
entrypoints=0.2.2=py27_0
functools32=3.2.3.2=py27_0
get_terminal_size=1.0.0=py27_0
ipykernel=4.3.1=py27_0
ipython=4.2.0=py27_0
ipython_genutils=0.1.0=py27_0
ipywidgets=4.1.1=py27_0
jinja2=2.8=py27_1
jpeg=8d=vc9_0
jsonschema=2.5.1=py27_0
jupyter=1.0.0=py27_3
jupyter_client=4.3.0=py27_0
jupyter_console=4.1.1=py27_0
jupyter_core=4.1.0=py27_0
libpng=1.6.22=vc9_0
libtiff=4.0.6=vc9_2
markupsafe=0.23=py27_2
mistune=0.7.2=py27_0
nbconvert=4.2.0=py27_0
nbformat=4.0.1=py27_0
notebook=4.2.1=py27_0
openssl=1.0.2h=vc9_0
path.py=8.2.1=py27_0
pathlib2=2.1.0=py27_0
pickleshare=0.7.2=py27_0
pip=8.1.2=py27_0
pygments=2.1.3=py27_0
pyqt=4.11.4=py27_6
pyreadline=2.1=py27_0
python=2.7.11=5
pyzmq=15.2.0=py27_0
qt=4.8.7=vc9_8
qtconsole=4.2.1=py27_0
setuptools=23.0.0=py27_0
simplegeneric=0.8.1=py27_1
singledispatch=3.4.0.3=py27_0
sip=4.16.9=py27_2
six=1.10.0=py27_0
ssl_match_hostname=3.4.0.2=py27_1
tornado=4.3=py27_1
traitlets=4.2.1=py27_0
vs2008_runtime=9.00.30729.1=2
wheel=0.29.0=py27_0
zlib=1.2.8=vc9_3

Upvotes: 4

Views: 2113

Answers (3)

Tian Zhang
Tian Zhang

Reputation: 351

According to conda list -h, conda list [regex] may help you list only packages matching this regular expression. For example, conda list jupyter will list packages start with jupyter, like jupyter_client, jupyter_core.

Moreover, it is hard to list top-level packages, as conda list just show all the linked packages.

Upvotes: 0

Carl M.
Carl M.

Reputation: 45

See this question covering the same topic.

Basically you can write "conda env export --from-history > environment.yml". Then you get a .yml file that lists the top-level packages you specified when the environment was created.

You could also view the command line history for installing the environment. This is contained in a log file called history found in: "your environment folder/conda-meta".

Upvotes: 2

kalefranz
kalefranz

Reputation: 4762

I thought we had a private function for this, but I can't find it in the code just now. We will at some point. For now, you can recover your full history in the environment with

conda list --revisions

or if the environment isn't currently activated

conda list --revisions --name ENVIRONMENT_NAME

For what it's worth, you can also roll back to any revision number with

conda install --revision REVISION_NUMBER

Upvotes: 2

Related Questions