Search code examples
pythonvirtualenvcondapipenv

PackagesNotFoundError: The following packages are not available from current channels, AFTER adding conda-forge channel?


Even after adding conda forge channel as suggested here:

PackagesNotFoundError: The following packages are not available from current channels:

Conda cannot still install many of the packages in a requirements.txt file :

conda install --file pip_requirements/requirements.txt 
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - prompt-toolkit==1.0.16
  - torch==1.0.0
  - chainer==2.0.1
  - ipython-genutils==0.2.0
  - gym==0.9.2
  - lief
  - chainerrl==0.2.0

Current channels:

  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/noarch
  - 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

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

Whats the use of conda if it cant even find a popular package like TORCH?!

Tried installing with pipenv too, that didnt work either..

pipenv install -r pip_requirements/requirements.txt 
Creating a virtualenv for this project…
Using /usr/bin/python3 (3.8.5) to create virtualenv…
⠋ModuleNotFoundError: No module named 'virtualenv.seed.via_app_data'
Error while trying to remove the /home/Johnny/.local/share/virtualenvs/myproject-uxejE6Q_ env: 
No such file or directory

Virtualenv location: 
Creating a Pipfile for this project…
Requirements file provided! Importing into Pipfile…
Creating a virtualenv for this project…
Using /usr/bin/python3 (3.8.5) to create virtualenv…
⠙ModuleNotFoundError: No module named 'virtualenv.seed.via_app_data'
Error while trying to remove the /home/Johnny/.local/share/virtualenvs/myproject-uxejE6Q_ env: 
No such file or directory

Virtualenv location: 
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…

Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  You can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
Could not find a version that matches Pygments<3.0.0,==2.4.2,>=2.6.0
Tried: 0.5, 0.5.1, 0.6, 0.7, 0.7.1, 0.8, 0.8.1, 0.9, 0.10, 0.11, 0.11.1, 1.0, 1.1, 1.1.1, 1.2, 1.2.1, 1.2.2, 1.3, 1.3.1, 1.4, 1.5, 1.6rc1, 1.6, 2.0rc1, 2.0rc1, 2.0rc1, 2.0, 2.0, 2.0, 2.0.1, 2.0.1, 2.0.1, 2.0.2, 2.0.2, 2.0.2, 2.1, 2.1, 2.1, 2.1.1, 2.1.1, 2.1.2, 2.1.2, 2.1.3, 2.1.3, 2.2.0, 2.2.0, 2.3.0, 2.3.0, 2.3.1, 2.3.1, 2.4.0, 2.4.0, 2.4.1, 2.4.1, 2.4.2, 2.4.2, 2.5.1, 2.5.1, 2.5.2, 2.5.2, 2.6.0, 2.6.0, 2.6.1, 2.6.1, 2.7.0, 2.7.0, 2.7.1, 2.7.1, 2.7.2, 2.7.2

Solution

  • There are a few issues:

    1. Old Packages. A few of those packages are available through both defaults and conda-forge channels, but the versions you are requesting are quite old. If you must have such old versions, then switch to using a YAML, and including a pip: section to install them from PyPI.

    2. Package Naming. Unfortunately, there is not a uniformly enforced policy on Conda package naming, and since Conda supports a broader language base than PyPI, there are inevitable naming collisions. One of the common, but not universally adopted naming strategies is <language>-<package>, which for Python is usually, py-<package>. I suspect lief is one of these, i.e., you actually want py-lief.

    3. Specialized Channels. Not every package maintainer has adopted Conda Forge, and PyTorch is a key one. If you need PyTorch packages, you'll need the pytorch channel.

    Overall, be aware that you are switching to a new ecosystem and it's not perfect, and sometimes not even reasonable. Unfortunately, there is no simple pip freeze to conda install workflow that sources all packages from Conda.

    There is kind of an exception to this, which is to not use Conda package management at all, but instead only use it for environment creation, isolation, and activation. Doing so sacrifices all the redundancy reduction and deep dependency resolution that Conda provides, but I suppose for a quick-and-dirty recreation of an existing PyPI-based install it may have a time and place.

    Otherwise, I recommend making a point to search Anaconda Cloud before installing a new package, to make sure the description matches what one actually wants to install.