Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to force conda install to install the packages and its dependencies instead of giving an error

I have a miniconda environment that I am installing packages in. I want to install a package and I understand that there can be some conflicts, however to resolve those conflicts either requires a missing package install or downgrade/upgrade of another and it has become a long rabbit hole of trying to downgrade, upgrade and install packages. Is there a way to force conda to do this all automatically as it currently does not. Example install is:

conda install psycopg2=2.7.5=py35h74b6da3_2

which is the package, the version and the python I'm using, however I get a Error that never seems to end.

UnsatisfiableError: The follow specifications were found to be in conflict:
-defaults/win-64::qt==5.9.7 ->openssl[version='1.1.*,>1=1.1.1a,<1.1.2a']
-openssl=1.0.2r

And then tells me to look at its dependencies and then it list more packages that need install and I'm not sure when it ends...

Any help would be great.

like image 923
Cam Avatar asked Mar 29 '19 15:03

Cam


1 Answers

this is a long running problem in Python package management. Thus, as far as I know, Anaconda doesn't provide a solution for it. But, here is one which will require you to replace conda usage with another Python package designed for such issue: Poetry (https://python-poetry.org/)

  1. Install Poetry: curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
  2. Create a virtual environment for your project using Pyenv, or conda or whatever: conda create -n myenv python=3.6
  3. Activate your virtual environment: conda activate myenv
  4. Create a Poetry projet with poetry init
  5. Add your package dependencies to your virtual environment with poetry add my-package

Poetry handles package dependencies for you, and offers useful commands like poetry update to easily update package versions when available without breaking the whole thing. You can also install the environment from an existing pyproject.toml (capturing dependencies) file using poetry install.

Poetry is becoming a standard in Python ecosystem (>= 13k stars on Github).

like image 89
fpajot Avatar answered Oct 22 '22 19:10

fpajot