如何检查conda development是否安装了我的项目/软件包? [英] How does one check if conda develop installed my project/packages?

查看:131
本文介绍了如何检查conda development是否安装了我的项目/软件包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何查看在开发模式下安装的软件包?
我尝试了 conda列表,但是没有。

我运行了 conda development。似乎已经安装了它:

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'

但是当我做conda列表时,我看不到任何我认识的东西:

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

任何人都知道什么

请注意我的脚本可以正常工作吗?或者至少我在开发模式下安装的软件包会显示在哪里?现在,在使用 conda development -u。安装和卸载之后,但我仍然不知道如何显示是否已安装处于开发模式的软件包/项目。

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.

推荐答案

如果您在运行 conda development。(其中 setup.py 文件是),您会注意到该命令输出以下内容:

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

如果您随后检查 sys.path python,则可以添加新路径:

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

您可以通过删除并打印<$的内容来确认c $ c> sys.path :

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

再次检查系统路径:

(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

现在它消失了!

另外,请注意conda或python(不是确定哪个)还会始终添加当前路径。需要特别注意的是,当我在回购之外进行导入测试时,我当时无法正常工作,但它位于回购内部,这似乎非常神秘,我只能将其归因于此。

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.

检查来自终端的python sys.path使用python cmd作为字符串运行该命令:

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

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

甚至更好:

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

如果需要别名:

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

将其放入您的 .zshrc 中。

老实说,我知道的唯一方法就是尝试再次安装。通常已经说过了:

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 .

输出应该是这样的:

(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 .

输出看起来像这样:

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

其中。可以替换为项目根目录的路径(对我来说,这是setup.py所在的位置)。

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

注意:

另一项测试是尝试将其卸载两次。第二次它应该抱怨:

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:如何在pip可编辑模式下卸载:如何使用pip卸载可编辑软件包(与-e一起安装)

这篇关于如何检查conda development是否安装了我的项目/软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆