Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one check if conda develop installed my project/packages?

How do I see the packages that I've installed in development mode? I tried conda list but it didn't show anything familiar.

I ran conda develop . and it seems it installed it:

(automl-meta-learning) brandomiranda~/automl-meta-learning/automl ❯ conda develop .
path exists, skipping /Users/brandomiranda/automl-meta-learning/automl
completed operation for: /Users/brandomiranda/automl-meta-learning/automl

however, I get errors when I run my scripts:

(automl-meta-learning) brandomiranda~/automl-meta-learning/automl/automl/meta_optimizers ❯ python differentiable_SGD.py
Traceback (most recent call last):
  File "differentiable_SGD.py", line 8, in <module>
    from automl.utils.torch_utils import helloworld
ModuleNotFoundError: No module named 'automl.utils'

but when I do conda list I don't see anything I recognize:

(automl-meta-learning) brandomiranda~/automl-meta-learning/automl/automl/meta_optimizers ❯ conda list
# packages in environment at /Users/brandomiranda/miniconda3/envs/automl-meta-learning:
#
# Name                    Version                   Build  Channel
appnope                   0.1.0                    py37_0
asn1crypto                1.3.0                    py37_0
astroid                   2.3.3                    py37_0
attrs                     19.3.0                     py_0
backcall                  0.1.0                    py37_0
beautifulsoup4            4.8.2                    py37_0
blas                      1.0                         mkl
bleach                    3.1.0                    py37_0
bzip2                     1.0.8                h1de35cc_0
ca-certificates           2019.11.27                    0
certifi                   2019.11.28               py37_0
cffi                      1.13.2           py37hb5b8e2f_0
chardet                   3.0.4                 py37_1003
conda                     4.8.1                    py37_0
conda-build               3.18.11                  py37_0
conda-package-handling    1.6.0            py37h1de35cc_0
cryptography              2.8              py37ha12b0ac_0
cycler                    0.10.0                   py37_0
dbus                      1.13.12              h90a0687_0
decorator                 4.4.1                      py_0
defusedxml                0.6.0                      py_0
entrypoints               0.3                      py37_0
expat                     2.2.6                h0a44026_0
filelock                  3.0.12                     py_0
freetype                  2.9.1                hb4e5f40_0
gettext                   0.19.8.1             h15daf44_3
glib                      2.63.1               hd977a24_0
glob2                     0.7                        py_0
icu                       58.2                 h4b95b61_1
idna                      2.8                      py37_0
importlib_metadata        1.3.0                    py37_0
intel-openmp              2019.4                      233
ipykernel                 5.1.3            py37h39e3cac_1
ipython                   7.11.1           py37h39e3cac_0
ipython_genutils          0.2.0                    py37_0
ipywidgets                7.5.1                      py_0
isort                     4.3.21                   py37_0
jedi                      0.15.2                   py37_0
jinja2                    2.10.3                     py_0
jpeg                      9b                   he5867d9_2
jsonschema                3.2.0                    py37_0
jupyter                   1.0.0                    py37_7
jupyter_client            5.3.4                    py37_0
jupyter_console           6.0.0                    py37_0
jupyter_core              4.6.1                    py37_0
kiwisolver                1.1.0            py37h0a44026_0
lazy-object-proxy         1.4.3            py37h1de35cc_0
libarchive                3.3.3                h786848e_5
libcxx                    4.0.1                hcfea43d_1
libcxxabi                 4.0.1                hcfea43d_1
libedit                   3.1.20181209         hb402a30_0
libffi                    3.2.1                h475c297_4
libgfortran               3.0.1                h93005f0_2
libiconv                  1.15                 hdd342a3_7
liblief                   0.9.0                h2a1bed3_2
libpng                    1.6.37               ha441bb4_0
libsodium                 1.0.16               h3efe00b_0
libtiff                   4.1.0                hcb84e12_0
libxml2                   2.9.9                hf6e021a_1
lz4-c                     1.8.1.2              h1de35cc_0
lzo                       2.10                 h362108e_2
markupsafe                1.1.1            py37h1de35cc_0
matplotlib                3.1.1            py37h54f8f79_0
mccabe                    0.6.1                    py37_1
mistune                   0.8.4            py37h1de35cc_0
mkl                       2019.4                      233
mkl-service               2.3.0            py37hfbe908c_0
mkl_fft                   1.0.15           py37h5e564d8_0
mkl_random                1.1.0            py37ha771720_0
more-itertools            8.0.2                      py_0
nbconvert                 5.6.1                    py37_0
nbformat                  4.4.0                    py37_0
ncurses                   6.1                  h0a44026_1
ninja                     1.9.0            py37h04f5b5a_0
notebook                  6.0.2                    py37_0
numpy                     1.18.1           py37h7241aed_0
numpy-base                1.18.1           py37h6575580_0
olefile                   0.46                     py37_0
openssl                   1.1.1d               h1de35cc_3
pandoc                    2.2.3.2                       0
pandocfilters             1.4.2                    py37_1
parso                     0.5.2                      py_0
pcre                      8.43                 h0a44026_0
pexpect                   4.7.0                    py37_0
pickleshare               0.7.5                    py37_0
pillow                    7.0.0            py37h4655f20_0
pip                       19.3.1                   py37_0
pkginfo                   1.5.0.1                  py37_0
prometheus_client         0.7.1                      py_0
prompt_toolkit            2.0.10                     py_0
psutil                    5.6.7            py37h1de35cc_0
ptyprocess                0.6.0                    py37_0
py-lief                   0.9.0            py37h1413db1_2
pycosat                   0.6.3            py37h1de35cc_0
pycparser                 2.19                     py37_0
pygments                  2.5.2                      py_0
pylint                    2.4.4                    py37_0
pyopenssl                 19.1.0                   py37_0
pyparsing                 2.4.6                      py_0
pyqt                      5.9.2            py37h655552a_2
pyrsistent                0.15.6           py37h1de35cc_0
pysocks                   1.7.1                    py37_0
python                    3.7.6                h359304d_2
python-dateutil           2.8.1                      py_0
python-graphviz           0.13.2                   pypi_0    pypi
python-libarchive-c       2.8                     py37_13
pytorch                   1.4.0                   py3.7_0    pytorch
pytz                      2019.3                     py_0
pyyaml                    5.2              py37h1de35cc_0
pyzmq                     18.1.0           py37h0a44026_0
qt                        5.9.7                h468cd18_1
qtconsole                 4.6.0                      py_1
readline                  7.0                  h1de35cc_5
requests                  2.22.0                   py37_1
ripgrep                   11.0.2               he32d670_0
ruamel_yaml               0.15.87          py37h1de35cc_0
send2trash                1.5.0                    py37_0
setuptools                44.0.0                   py37_0
sip                       4.19.8           py37h0a44026_0
six                       1.13.0                   py37_0
soupsieve                 1.9.5                    py37_0
sqlite                    3.30.1               ha441bb4_0
terminado                 0.8.3                    py37_0
testpath                  0.4.4                      py_0
tk                        8.6.8                ha441bb4_0
torchvision               0.5.0                  py37_cpu    pytorch
torchviz                  0.0.1                    pypi_0    pypi
tornado                   6.0.3            py37h1de35cc_0
tqdm                      4.41.1                     py_0
traitlets                 4.3.3                    py37_0
urllib3                   1.25.7                   py37_0
wcwidth                   0.1.7                    py37_0
webencodings              0.5.1                    py37_1
wheel                     0.33.6                   py37_0
widgetsnbextension        3.5.1                    py37_0
wrapt                     1.11.2           py37h1de35cc_0
xz                        5.2.4                h1de35cc_4
yaml                      0.1.7                hc338f04_2
zeromq                    4.3.1                h0a44026_3
zipp                      0.6.0                      py_0
zlib                      1.2.11               h1de35cc_3
zstd                      1.3.7                h5bba6e5_0

anyone know whats going on or at least where the packages I've installed in development mode would show up?


Note that my scripts work now after installing and uninstalling using conda develop -u . but I still don't know how to display if the packages/projects in development mode are installed or not.

like image 929
Charlie Parker Avatar asked Jan 24 '20 20:01

Charlie Parker


People also ask

Where can I find conda installed packages?

Conda installs packages into the anaconda/pkgs directory.

What is conda develop?

conda-develop (just like pip --editable) provides a way to import a python module which is under local development on the same time. No conda/pip package is built, released, installed after each modification, still other projects can import it.


1 Answers

If you look carefully after running conda develop . (where the setup.py file is) you will notice that the command outputs the following:

(automl) brandBrandoParetoopareto~/ultimate-utils/uutils $ conda develop .
added /Users/brandBrandoParetoopareto/ultimate-utils/uutils
completed operation for: /Users/brandBrandoParetoopareto/ultimate-utils/uutils

if you then check the sys.path python has then you can that new path has been added:

(automl) brandBrandoParetoopareto~/ultimate-utils/uutils $ python
Python 3.7.7 (default, Mar 26 2020, 10:32:53) 
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> for p in sys.path:
...     print(p)
... 

/Users/brandBrandoParetoopareto/anaconda3/envs/automl/lib/python37.zip
/Users/brandBrandoParetoopareto/anaconda3/envs/automl/lib/python3.7
/Users/brandBrandoParetoopareto/anaconda3/envs/automl/lib/python3.7/lib-dynload
/Users/brandBrandoParetoopareto/anaconda3/envs/automl/lib/python3.7/site-packages
/Users/brandBrandoParetoopareto/automl-meta-learning/automl
/Users/brandBrandoParetoopareto/higher
/Users/brandBrandoParetoopareto/ultimate-utils/uutils

you can confirm this by removing it and printing the contents of sys.path:

(automl) brandBrandoParetoopareto~/ultimate-utils/uutils $ conda develop -u .
uninstalled: /Users/brandBrandoParetoopareto/ultimate-utils/uutils

check sys path again:

(automl) brandBrandoParetoopareto~/ultimate-utils/uutils $ python
Python 3.7.7 (default, Mar 26 2020, 10:32:53) 
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> for p in sys.path:
...     print(p)
... 

/Users/brandBrandoParetoopareto/anaconda3/envs/automl/lib/python37.zip
/Users/brandBrandoParetoopareto/anaconda3/envs/automl/lib/python3.7
/Users/brandBrandoParetoopareto/anaconda3/envs/automl/lib/python3.7/lib-dynload
/Users/brandBrandoParetoopareto/anaconda3/envs/automl/lib/python3.7/site-packages
/Users/brandBrandoParetoopareto/automl-meta-learning/automl
/Users/brandBrandoParetoopareto/higher

now it's gone!

Also, note that conda or python (not sure which) also adds the current path always. This is important to note because when I did import tests outside of the repo I was working it wasn't working but it was inside the repo which seemed very mysterious which I can only attribute to that.


Addendum

to check python sys.path from terminal run that command as a string with python cmd:

python -c "import sys; print(sys.path)"

even better:

python -c "import sys; [print(p) for p in sys.path]"

if you want an alias:

alias pypath='python -c "import sys; [print(p) for p in sys.path]"'

put it in your .zshrc.


Old answer

Honestly the only way I know is to just try to install it again. It usually says its there already:

(automl) brandBrandoParetoopareto~/ultimate-utils/uutils $ conda develop .
path exists, skipping /Users/brandBrandoParetoopareto/ultimate-utils/uutils
completed operation for: /Users/brandBrandoParetoopareto/ultimate-utils/uutils

if it says it's there already but your scripts still don't work just try installing and uninstalling:

conda develop -u .

the output should be something like this:

(automl) brandBrandoParetoopareto~/ultimate-utils/uutils $ conda develop -u .
uninstalled: /Users/brandBrandoParetoopareto/ultimate-utils/uutils

then again try to install it in develop/developing/developer mode:

conda develop .

output looks something like this:

(automl) brandBrandoParetoopareto~/ultimate-utils/uutils $ conda develop -u .
uninstalled: /Users/brandBrandoParetoopareto/ultimate-utils/uutils

where . can be substituted to a path to the root of your project (for me it's where setup.py is at).


Note:

An additional test is to try to uninstall it twice. The second time it should complain:

(importtest) brandBrandoParetoopareto~/ultimate-utils/uutils $ conda develop -u .
uninstalled: /Users/brandBrandoParetoopareto/ultimate-utils/uutils
(importtest) brandBrandoParetoopareto~/ultimate-utils/uutils $ conda develop -u .
conda.pth does not contain path: /Users/brandBrandoParetoopareto/ultimate-utils/uutils
package not installed via conda develop

Fyi: how uninstall in pip editable mode: How to uninstall editable packages with pip (installed with -e)

like image 164
Charlie Parker Avatar answered Oct 18 '22 01:10

Charlie Parker