Installing Python package will download, install, and remove other packages - python

I want to install cvxopt in Anaconda Python. Here's the version of my software:
$ python --version
Python 3.6.5 :: Anaconda, Inc.
$ conda --version
conda 4.5.11
$ anaconda --version
anaconda Command line client (version 1.6.14)
I try to install by typing:
conda install cvxopt
I was prompted that about 40 packages will be downloaded, about 10 NEW packages will be installed, the package anaconda will be removed, and about 25 packages will be updated?
Are the NEW packages dependencies?
Why will conda remove the anaconda package? Isn't conda a part of anaconda?
Here is the full output:
Solving environment: done
## Package Plan ##
environment location: /usr/local/anaconda3
added / updated specs:
- cvxopt
The following packages will be downloaded:
package | build
---------------------------|-----------------
suitesparse-5.2.0 | h171a5a3_0 2.4 MB
openssl-1.1.1a | h7b6447c_0 5.0 MB
freetype-2.9.1 | h8a8886c_1 822 KB
harfbuzz-1.8.8 | hffaf4a1_0 863 KB
libssh2-1.8.0 | h1ba5d50_4 233 KB
cairo-1.14.12 | h8948797_3 1.3 MB
libstdcxx-ng-8.2.0 | hdf63c60_1 2.9 MB
conda-4.6.1 | py36_0 1.7 MB
glpk-4.65 | h3ceedfd_2 1.1 MB
expat-2.2.6 | he6710b0_0 187 KB
krb5-1.16.1 | h173b8e3_7 1.4 MB
tbb-2018.0.5 | h6bb024c_0 1.4 MB
sqlite-3.26.0 | h7b6447c_0 1.9 MB
cvxopt-1.2.0 | py36h9e0dedd_0 537 KB
glib-2.56.2 | hd408876_0 5.0 MB
python-3.6.8 | h0371630_0 34.4 MB
certifi-2018.11.29 | py36_0 146 KB
gsl-2.4 | h14c3975_4 2.6 MB
cryptography-2.4.2 | py36h1ba5d50_0 618 KB
libuuid-1.0.3 | h1bed415_2 16 KB
curl-7.63.0 | hbc83047_1000 145 KB
libgcc-ng-8.2.0 | hdf63c60_1 7.6 MB
fribidi-1.0.5 | h7b6447c_0 112 KB
ca-certificates-2018.12.5 | 0 123 KB
pango-1.42.3 | h8589676_0 522 KB
libpng-1.6.36 | hbc83047_0 346 KB
pycurl-7.43.0.2 | py36h1ba5d50_0 185 KB
tk-8.6.8 | hbc83047_0 3.1 MB
qt-5.9.7 | h5867ecd_1 85.9 MB
mkl-2018.0.3 | 1 198.7 MB
libcurl-7.63.0 | h20c2e04_1000 550 KB
metis-5.1.0 | hf484d3e_4 4.1 MB
fontconfig-2.13.0 | h9420a91_0 291 KB
matplotlib-3.0.2 | py36h5429711_0 6.5 MB
pillow-5.4.1 | py36h34e0f95_0 627 KB
------------------------------------------------------------
Total: 373.2 MB
The following NEW packages will be INSTALLED:
cvxopt: 1.2.0-py36h9e0dedd_0
fribidi: 1.0.5-h7b6447c_0
glpk: 4.65-h3ceedfd_2
gsl: 2.4-h14c3975_4
krb5: 1.16.1-h173b8e3_7
libuuid: 1.0.3-h1bed415_2
metis: 5.1.0-hf484d3e_4
suitesparse: 5.2.0-h171a5a3_0
tbb: 2018.0.5-h6bb024c_0
The following packages will be REMOVED:
anaconda: 5.2.0-py36_3
The following packages will be UPDATED:
ca-certificates: 2018.03.07-0 --> 2018.12.5-0
cairo: 1.14.12-h7636065_2 --> 1.14.12-h8948797_3
certifi: 2018.4.16-py36_0 --> 2018.11.29-py36_0
conda: 4.5.11-py36_0 --> 4.6.1-py36_0
cryptography: 2.2.2-py36h14c3975_0 --> 2.4.2-py36h1ba5d50_0
curl: 7.60.0-h84994c4_0 --> 7.63.0-hbc83047_1000
expat: 2.2.5-he0dffb1_0 --> 2.2.6-he6710b0_0
fontconfig: 2.12.6-h49f89f6_0 --> 2.13.0-h9420a91_0
freetype: 2.8-hab7d2ae_1 --> 2.9.1-h8a8886c_1
glib: 2.56.1-h000015b_0 --> 2.56.2-hd408876_0
harfbuzz: 1.7.6-h5f0a787_1 --> 1.8.8-hffaf4a1_0
libcurl: 7.60.0-h1ad7b7a_0 --> 7.63.0-h20c2e04_1000
libgcc-ng: 7.2.0-hdf63c60_3 --> 8.2.0-hdf63c60_1
libpng: 1.6.34-hb9fc6fc_0 --> 1.6.36-hbc83047_0
libssh2: 1.8.0-h9cfc8f7_4 --> 1.8.0-h1ba5d50_4
libstdcxx-ng: 7.2.0-hdf63c60_3 --> 8.2.0-hdf63c60_1
matplotlib: 2.2.2-py36h0e671d2_1 --> 3.0.2-py36h5429711_0
mkl: 2018.0.2-1 --> 2018.0.3-1
openssl: 1.0.2o-h20670df_0 --> 1.1.1a-h7b6447c_0
pango: 1.41.0-hd475d92_0 --> 1.42.3-h8589676_0
pillow: 5.1.0-py36h3deb7b8_0 --> 5.4.1-py36h34e0f95_0
pycurl: 7.43.0.1-py36hb7f436b_0 --> 7.43.0.2-py36h1ba5d50_0
python: 3.6.5-hc3d631a_2 --> 3.6.8-h0371630_0
qt: 5.9.5-h7e424d6_0 --> 5.9.7-h5867ecd_1
sqlite: 3.23.1-he433501_0 --> 3.26.0-h7b6447c_0
tk: 8.6.7-hc745277_3 --> 8.6.8-hbc83047_0
Proceed ([y]/n)? n
CondaSystemExit: Exiting.

The anaconda package is called a "meta-package" because it does not contain any code itself, but instead specifies dependencies of other packages that should be installed. The package cvoptx is not one of the packages specified by the anaconda package, so if you try to install cvoptx, there is a conflict that conda resolves by removing the anaconda package (since you give cvoptx higher priority by specifying as required to be installed in the environment).
conda and anaconda are separate, and have separate versions. conda is the command line interface that allows you to install, update, and remove packages and environments. anaconda is described above.
Finally (and confusingly), the anaconda command on the command line is provided by the anaconda-client package, not the anaconda package. If you want to see the version of Anaconda that is installed, use conda list anaconda. If you want the version of the anaconda-client command line tool, use anaconda --version. The anaconda-client is used to upload packages and environments to https://anaconda.org

The best way is to install it in a separate environment. It is recommended to have different environments for each project. I tend to avoid mixing project requirements together. For the project using cvxopt, I would do:
conda create --name cvx python=3.6
So here I create an environment called cvx that has Python 3.6
This will download all needed packages for Python36. Since it is a clean environment, there would be no upgrading or downgrading.
After that you can activate your environment as:
conda activate cvx
conda install -c conda-forge cvxopt
In these environment you have cvxopt. You can the build your project and run it in these environment. If you need extra packages, you can do:
conda install -n cvxopt PACKAGESNAME
Here is everything you need to know to work with environments https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

Related

Conda times out when attempted to run 'conda install python=3.7' from a ubuntu vm in azure pipeline

Why can't conda complete an update when running on an azure vm as part of an azure build pipeline?
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /usr/share/miniconda/pkgs
/home/vsts/.conda/pkgs
envs directories : /usr/share/miniconda/envs
/home/vsts/.conda/envs
platform : linux-64
user-agent : conda/4.10.3 requests/2.25.1 CPython/3.9.5 Linux/5.8.0-1040-azure ubuntu/20.04.3 glibc/2.31
UID:GID : 1001:121
netrc file : None
offline mode : False
track_features: []
unsatisfiable_hints: True
unsatisfiable_hints_check_depth: 2
update_modifier: update_specs
use_index_cache: False
use_local: False
use_only_tar_bz2: False
verbosity: 0
verify_threads: 1
whitelist_channels: []
conda install -c anaconda python=3.7
cryptography-3.4.7 | py37hd23ed53_0 904 KB
openssl-1.1.1l | h7f8727e_0 2.5 MB
pip-21.0.1 | py37h06a4308_0 1.8 MB
pycosat-0.6.3 | py37h27cfd23_0 81 KB
pysocks-1.7.1 | py37_1 27 KB
python-3.7.11 | h12debd9_0 45.3 MB
ruamel_yaml-0.15.100 | py37h27cfd23_0 253 KB
setuptools-52.0.0 | py37h06a4308_0 710 KB
------------------------------------------------------------
Total: 56.1 MB
The following packages will be UPDATED:
openssl 1.1.1k-h27cfd23_0 --> 1.1.1l-h7f8727e_0
pysocks 1.7.1-py39h06a4308_0 --> 1.7.1-py37_1
The following packages will be DOWNGRADED:
brotlipy 0.7.0-py39h27cfd23_1003 --> 0.7.0-py37h27cfd23_1003
certifi 2021.5.30-py39h06a4308_0 --> 2021.5.30-py37h06a4308_0
cffi 1.14.6-py39h400218f_0 --> 1.14.6-py37h400218f_0
chardet 4.0.0-py39h06a4308_1003 --> 4.0.0-py37h06a4308_1003
conda 4.10.3-py39h06a4308_0 --> 4.10.3-py37h06a4308_0
conda-package-han~ 1.7.3-py39h27cfd23_1 --> 1.7.3-py37h27cfd23_1
cryptography 3.4.7-py39hd23ed53_0 --> 3.4.7-py37hd23ed53_0
pip 21.1.3-py39h06a4308_0 --> 21.0.1-py37h06a4308_0
pycosat 0.6.3-py39h27cfd23_0 --> 0.6.3-py37h27cfd23_0
python 3.9.5-h12debd9_4 --> 3.7.11-h12debd9_0
ruamel_yaml 0.15.100-py39h27cfd23_0 --> 0.15.100-py37h27cfd23_0
setuptools 52.0.0-py39h06a4308_0 --> 52.0.0-py37h06a4308_0
It will stall here until 60 minute timeout.
Thank you C.B. and Merv. Posting your suggestion as an answer to help other community members.
You can run it manually on a permanent VM instead of the ephemeral pipeline VM. There is a prompt during execution: Proceed ([y]/n)?. The output in Azure does not reveal this prompt.
To overcome timing out while waiting for the prompt reply, you can run this command conda install -y. It does not ask for confirmation.
You can refer to Conda - Silently installing a package and conda install

Python not recognizing pyarrow version properly?

When trying to load some parquet files into pandas DataFrame, I get an error claiming that Pyarrow version should be at least 0.16.
If I check the version installed, I confirm that:
>>> import pyarrow
>>> pyarrow.__version__
'0.11.0'
However, when trying to install version 0.16, with
conda install -c conda-forge pyarrow=0.16
I see the following:
The following packages will be downloaded:
package | build
---------------------------|-----------------
arrow-cpp-0.16.0 | py37hf731a26_1 19.8 MB conda-forge
aws-sdk-cpp-1.7.164 | hba45d7a_2 2.1 MB conda-forge
boost-cpp-1.72.0 | h7b93d67_2 16.3 MB conda-forge
numpy-1.19.5 | py37haa41c4c_1 5.3 MB conda-forge
pyarrow-0.16.0 | py37h110162e_2 4.1 MB conda-forge
re2-2020.04.01 | he1b5a44_0 438 KB conda-forge
thrift-cpp-0.13.0 | h5aa387f_5 19.2 MB conda-forge
zstd-1.4.4 | h3b9ef0a_2 982 KB conda-forge
------------------------------------------------------------
Total: 68.1 MB
The following NEW packages will be INSTALLED:
boost-cpp conda-forge/linux-64::boost-cpp-1.72.0-h7b93d67_2
curl conda-forge/linux-64::curl-7.77.0-hea6ffbf_0
icu conda-forge/linux-64::icu-67.1-he1b5a44_0
pandas conda-forge/linux-64::pandas-1.2.5-py37h219a48f_0
python-dateutil conda-forge/noarch::python-dateutil-2.8.1-py_0
pytz conda-forge/noarch::pytz-2021.1-pyhd8ed1ab_0
thrift-cpp conda-forge/linux-64::thrift-cpp-0.13.0-h5aa387f_5
The following packages will be REMOVED:
orc-1.6.8-h58a87f1_0
The following packages will be DOWNGRADED:
arrow-cpp 4.0.1-py37hac2aefd_2_cpu --> 0.16.0-py37hf731a26_1
aws-sdk-cpp 1.8.186-hb4091e7_3 --> 1.7.164-hba45d7a_2
grpc-cpp 1.38.1-h36ce80c_0 --> 1.25.0-h213be95_2
libprotobuf 3.16.0-h780b84a_0 --> 3.11.0-h8b12597_0
lz4-c 1.9.3-h9c3ff4c_0 --> 1.8.3-he1b5a44_1001
numpy 1.21.0-py37h038b26d_0 --> 1.19.5-py37haa41c4c_1
pyarrow 4.0.1-py37he2832ee_2_cpu --> 0.16.0-py37h110162e_2
re2 2021.06.01-h9c3ff4c_0 --> 2020.04.01-he1b5a44_0
zstd 1.5.0-ha95c52a_0 --> 1.4.4-h3b9ef0a_2
Why pyarrow.__version__ returns 0.11 and the terminal ask for a DOWNGRADE from 4.0.1?
Your help is much appreciated.
EDIT to provide more information:
Doing: conda list pyarrow after activating my virtual environment returns:
# Name Version Build Channel
pyarrow 4.0.1 py37he2832ee_2_cpu conda-forge
However, if I start python, I check the library is not being load from my vritual environment but from outside:
>>> import pyarrow
>>> pyarrow.__file__
'/home/myuser/.local/lib/python3.7/site-packages/pyarrow/__init__.py'
And if I check my sys.path, what I see is the following:
>>> import sys
>>> sys.path
['', '/home/myuser/.conda/envs/myenv/lib/python37.zip', '/home/myuser/.conda/envs/myenv/lib/python3.7', '/home/myuser/.conda/envs/myenv/lib/python3.7/lib-dynload', '/home/myuser/.local/lib/python3.7/site-packages', '/home/myuser/.conda/envs/myenv/lib/python3.7/site-packages']
Is it relevant that '/home/myuser/.local/lib/python3.7/site-packages' appears before '/home/myuser/.conda/envs/myenv/lib/python3.7/site-packages'?

Conda update python wants to update other packages, not python

I have a conda environment running Python 3.7.5. I tried updating it to the latest version (3.8.0) but it wants to update other packages (even downgrade scipy), and says nothing about upgrading Python.
Why is this happening?
(workenv) $ conda update python
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /home/gabriel/miniconda3/envs/workenv
added / updated specs:
- python
The following packages will be downloaded:
package | build
---------------------------|-----------------
blas-1.0 | openblas 46 KB
certifi-2019.9.11 | py37_0 154 KB
libopenblas-0.3.6 | h5a2b251_2 7.7 MB
numpy-1.17.4 | py37hd5be1e1_0 4 KB
numpy-base-1.17.4 | py37h2f8d375_0 4.1 MB
scipy-1.3.1 | py37he2b7bc3_0 14.0 MB
------------------------------------------------------------
Total: 26.0 MB
The following NEW packages will be INSTALLED:
libopenblas pkgs/main/linux-64::libopenblas-0.3.6-h5a2b251_2
The following packages will be REMOVED:
intel-openmp-2019.4-243
mkl-2019.4-243
mkl-service-2.3.0-py37he904b0f_0
mkl_fft-1.0.15-py37ha843d7b_0
mkl_random-1.1.0-py37hd6b4f25_0
The following packages will be UPDATED:
blas 1.0-mkl --> 1.0-openblas
ca-certificates conda-forge::ca-certificates-2019.9.1~ --> pkgs/main::ca-certificates-2019.10.16-0
numpy 1.17.3-py37hd14ec0e_0 --> 1.17.4-py37hd5be1e1_0
numpy-base 1.17.3-py37hde5b4d6_0 --> 1.17.4-py37h2f8d375_0
openssl conda-forge::openssl-1.1.1d-h516909a_0 --> pkgs/main::openssl-1.1.1d-h7b6447c_3
The following packages will be SUPERSEDED by a higher-priority channel:
certifi conda-forge --> pkgs/main
The following packages will be DOWNGRADED:
scipy 1.3.1-py37h7c811a0_0 --> 1.3.1-py37he2b7bc3_0
Proceed ([y]/n)?
It's might check and install the dependencies of python before installing the python update itself. (You could check it by comparing the dependencies list of the different python versions.)
If the newest version of python is incompatible with the newest version of scipy, it will install an older version of scipy to make sure it will run stable.

spyder doesn't launch after installing pytorch

I installed pytorch but after that Spyder can no longer be launched. Here are the terminal info:
conda install pytorch torchvision -c pytorch Solving environment: done
==> WARNING: A newer version of conda exists. <== current version: 4.5.10 latest version: 4.5.11
Please update conda by running
$ conda update -n base -c defaults conda
Package Plan
environment location: /anaconda3/envs/base_py36
added / updated specs:
- pytorch
- torchvision
The following packages will be downloaded:
package | build
---------------------------|-----------------
torchvision-0.2.1 | py36_1 123 KB pytorch
scipy-1.1.0 | py36hf1f7d93_0 15.4 MB
scikit-learn-0.20.0 | py36h4f467ca_1 5.4 MB
numpy-base-1.15.2 | py36h8a80b8c_1 4.1 MB
numpy-1.11.3 | py36heee0a97_5 3.4 MB
ninja-1.8.2 | py36h04f5b5a_1 93 KB
pytorch-0.4.1 |py36_cuda0.0_cudnn0.0_1 10.0 MB pytorch
------------------------------------------------------------
Total: 38.5 MB
The following NEW packages will be INSTALLED:
ninja: 1.8.2-py36h04f5b5a_1
pytorch: 0.4.1-py36_cuda0.0_cudnn0.0_1 pytorch
torchvision: 0.2.1-py36_1 pytorch
The following packages will be REMOVED:
accelerate: 2.3.1-np111py36_0
The following packages will be UPDATED:
mkl: 11.3.3-0 --> 2019.0-118
numexpr: 2.6.7-py36hde7755b_0 --> 2.6.8-py36h1dc9127_0
numpy: 1.11.3-py36_nomklh8ecaf62_5 --> 1.11.3-py36heee0a97_5
numpy-base: 1.15.0-py36he97cb71_0 --> 1.15.2-py36h8a80b8c_1
scikit-learn: 0.19.1-py36_nomklhde7755b_0 --> 0.20.0-py36h4f467ca_1
scipy: 1.1.0-py36_nomklh7cd7d8e_0 --> 1.1.0-py36hf1f7d93_0
The following packages will be DOWNGRADED:
blas: 1.0-openblas --> 1.0-mkl
Proceed ([y]/n)? y
Downloading and Extracting Packages torchvision-0.2.1 | 123 KB |
############################### | 100% scipy-1.1.0 | 15.4 MB | ##################################### | 100% scikit-learn-0.20.0 | 5.4 MB |
############################### | 100% numpy-base-1.15.2 | 4.1 MB | ##################################### | 100% numpy-1.11.3 | 3.4 MB | ##################################### | 100%
ninja-1.8.2 | 93 KB |
############################### | 100% pytorch-0.4.1 | 10.0 MB | ##################################### | 100% Preparing transaction: done
I don't know if you have solved your issue, but in case you have and someone else comes across this question or you haven't and are still waiting:
I came across your post as a result of having the same thing happen to me...
It would seem that all I had to do was "conda update all" for it to start working again!
I came across it too. And I tried reopen Anaconda Navigator and it worked....

Anaconda/MacOS: Change default python version

I was using python with anaconda on osx 10.8 when spyder crashed. When I tried to restart it, the launcher showed it as uninstalled. I figured there might be something wrong with anaconda, so I restarted my computer, but the problem persisted.
Looking into it, I noticed the default version of python had been changed:
$ python --version
Python 3.4.1 :: Continuum Analytics, Inc.
I tried changing it back by using Apple's defaults write, relinking python with ln -sf, simply setting an alias python=python2.7, to no effect.
Then I tried removing python3 with conda, but conda remove python3 won't do the trick. Searching for packages produces this:
$ conda search python
Fetching package metadata: ..
(...)
python 1.0.1 0 defaults
(...)
. 2.7.5 2 defaults
. 2.7.5 3 defaults
(...)
* 3.4.1 0 defaults
I also looked up Continuum docs, and they recommend leaving 2.7 as standard and using an Anaconda environment if I want to use a different version, which doesn't help me.
Does anybody have any idea of how to change default version back to 2.7?
(Specs are: anaconda 1.7.0, osx 10.8.5, conda 3.5.2)
Alright, I found a similar problem in the Continuum mailing list.
This was solved by re-installing python through conda
$ conda install python=2.7
Fetching package metadata: ..
Solving package specifications: .
Package plan for installation in environment /Users/kadu/anaconda:
The following packages will be downloaded:
package | build
---------------------------|-----------------
conda-3.5.2 | py27_0 135 KB
pycosat-0.6.1 | py27_0 57 KB
python-2.7.6 | 2 16.5 MB
pyyaml-3.11 | py27_0 149 KB
requests-2.3.0 | py27_0 564 KB
------------------------------------------------------------
Total: 17.4 MB
The following packages will be UN-linked:
package | build
---------------------------|-----------------
conda-3.5.2 | py34_0
pycosat-0.6.1 | py34_0
python-3.4.1 | 0
pyyaml-3.11 | py34_0
requests-2.3.0 | py34_0
The following packages will be linked:
package | build
---------------------------|-----------------
conda-3.5.2 | py27_0 hard-link
pycosat-0.6.1 | py27_0 hard-link
python-2.7.6 | 2 hard-link
pyyaml-3.11 | py27_0 hard-link
requests-2.3.0 | py27_0 hard-link
Proceed ([y]/n)?
This can also be used to change which is the default package under anaconda environments:
$ conda install python=3.4
Fetching package metadata: ..
Solving package specifications: .
Package plan for installation in environment /Users/kadu/anaconda:
The following packages will be UN-linked:
package | build
---------------------------|-----------------
conda-3.5.2 | py27_0
pycosat-0.6.1 | py27_0
python-2.7.6 | 2
pyyaml-3.11 | py27_0
requests-2.3.0 | py27_0
The following packages will be linked:
package | build
---------------------------|-----------------
conda-3.5.2 | py34_0 hard-link
pycosat-0.6.1 | py34_0 hard-link
python-3.4.1 | 0 hard-link
pyyaml-3.11 | py34_0 hard-link
requests-2.3.0 | py34_0 hard-link
Proceed ([y]/n)?
However, this would require manually changing the builds to any other packages you use. I had to reinstall spyder, which seems to have caused the bug in the first place and was presumably reinstalled when I tried to launch it under the wrong version. All the other libraries, which I didn't try to reinstall, are still working fine under 2.7.

Categories