What is the best practice for installing version versions of Python modules in Anaconda?

I am using anaconda python distribution on Mac. I would like to play with the latest version of matplotlib source code on Github , make some changes and see how it works. But most of the time I just wanted to use the regular version of matplotlib that comes with Anaconda Python, so I would like to switch back and forth easily.

The matplotlib documentation has a good description of the branching process and requesting a download request , but it’s not clear to me how I actually install and use the matplotlib development version in such a way as to preserve my working Python implementation.

I assume that I want to set up an environment containing the latest version of matplotlib and its dependencies, and switch between this environment and the normal environment root. But when I use python setup.py developmatplotlib to install the version, it seems to install in both environments.

So what is best for working with the GitHub Python package version?

+4
source share
1 answer

As you mentioned in your question, it conda envmay support separate Python environments for development versions, depending on which packages you want to use.


, , python setup.py develop dev- matplotlib root. , , dev- matplotlib? :

~$ conda create --name matplotlib-dev --clone root
Fetching package metadata: ....
src_prefix: '/home/alistair/anaconda'
dst_prefix: '/home/alistair/anaconda/envs/matplotlib-dev'
Packages: 165
Files: 32
Linking packages ...
[      COMPLETE      ]|#####################################################| 100%
#
# To activate this environment, use:
# $ source activate matplotlib-dev
#
# To deactivate this environment, use:
# $ source deactivate
#
~$ conda info --envs 
# conda environments:
#
matplotlib-dev           /home/alistair/anaconda/envs/matplotlib-dev
root                  *  /home/alistair/anaconda

matplotlib-dev, , root.

~$ source activate matplotlib-dev
discarding /home/alistair/anaconda/bin from PATH
prepending /home/alistair/anaconda/envs/matplotlib-dev/bin to PATH

(matplotlib-dev)~$ conda info --envs 
# conda environments:
#
matplotlib-dev        *  /home/alistair/anaconda/envs/matplotlib-dev
root                     /home/alistair/anaconda

, setuptools (.. python setup.py install python setup.py develop), , numpy ...

pip install <path> pip install -e <path>, "" ( , python setup.py develop ):

(matplotlib-dev)~$ pip install -e git+git://github.com/matplotlib/matplotlib.git#egg=matplotlib-dev
Obtaining matplotlib from git+git://github.com/matplotlib/matplotlib.git#egg=matplotlib-dev
  Cloning git://github.com/matplotlib/matplotlib.git to ./src/matplotlib
...
Installing collected packages: matplotlib
  Running setup.py develop for matplotlib
Successfully installed matplotlib-1.5.0+337.g595868a

(matplotlib-dev)~$ python -c "import matplotlib; print(matplotlib.__version__)"
1.5.0.post337+g595868a

(matplotlib-dev)~$ source deactivate
discarding /home/alistair/anaconda/envs/matplotlib-dev/bin from PATH

~$ python -c "import matplotlib; print(matplotlib.__version__)"
1.4.3

#egg= , pip ./src/matplotlib-dev. URI git pip , , .

conda develop <path> pip install -e <path>, conda, , VCS pip .

+3

Source: https://habr.com/ru/post/1615291/


All Articles