Conda install local package fails - anaconda

I am trying to install packages in anaconda3 from a machine which does not have internet.
I downloaded the pkg.tar.gz package & ran
conda install pkgname.tar.gz
Then I get the annoying
Collecting package metadata (current_repodata.json):
& then it timesout.
I even tried the
conda install --offline pkg.tar.gz
I get
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:
- pkg.tar.gz
Current channels:
- 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.
What am i doing wrong ?
If i try to use pip from the anaconda few of the packages get installed, but this does not.
Follow up question
If i use pip to install a pakcage, would i be able to acccess it by conda & anaconda's python ?

I gave up on downloading packages manually & then installing them only to find out that I need to download some more packages(chain dependency).
I found out another easier way of using conda-pack where you can build your environment in a machine that has internet(this reduces the chain dependency problem) & then .tar it, then transport it to the non-internet connected machine & then untar it.
More info can be found here https://conda.github.io/conda-pack/
I hope this solves time & effort for someone.

You may find a way like this:
First unzip your .gz and get the .tar
Find your Conda env.
conda info --envs
Use conda activate according to your env e.g:
conda activate C:\SomePathGivenByCondaInfo
Use pip install with absolute path to ensure it:
pip install C:\downloads\SomePackage.tar

Related

conda create environment not responding

I want to install python 2.7 as a conda environment.
conda create -n python2 python=2.7 anaconda
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment:
it's been running for the last 12 hours.
If all that is actually needed is Python 2.7 environment (not full Anaconda distribution), then see #jakub's answer. However, Conda is perfectly capable of creating an Anaconda distribution environment with Python 2.7, and it should not take 12+ hours to solve.
Why so long? Channels!
The extremely long solve is almost certainly aggravated by your channel priorities. An "Anaconda" distribution should source most - if not all - of its software from the anaconda channel (part of defaults channel). However, most users eventually add conda-forge into their global channels and give it higher or equal priority (e.g., channel_priority: flexible). When this is the case, Conda will spend a bunch of time trying to satisfy the packages specified within the anaconda metapackage with the latest versions from conda-forge, and that's what tends to bog things down.
Option 1: Avoid Mixing Anaconda and Conda Forge
If you want a faster Anaconda install, then install only from Anaconda
conda create -n anaconda27 --override-channels -c defaults python=2.7 anaconda
Everything in the anaconda metapackage was originally intended to be sourced from the anaconda channel, so this shouldn't be so unreasonable.
Note that if you have conda-forge prioritized globally, this will be an issue every time you install in this environment (so remember to override channels).
Option 2: Mamba
Another option is Mamba. It's a faster (compiled) drop-in alternative to the conda CLI functionality. It seems to both solve faster and less prone to mutate unrelated packages when requesting changes - but that's just my anecdotal experience.
# install it in your *base* env (only need this once)
conda install -n base conda-forge::mamba
# use it like you would `conda`
mamba create -n python2 python=2.7 anaconda
The anaconda package is a metapackage, meaning it tells conda to install other packages. It will install hundreds of packages, and it turns out this can stress conda. One typically does not need all of the packages in the anaconda metapackage -- it is often better to install only the packages one requires.
Try to create an environment without anaconda and instead specify only the packages you need.
conda create -n python2 python=2.7

Why creating Anaconda environments is taking forever

I'm interested in using a nice script from GitLab:
https://gitlab.com/RBP_Bioinformatics/mustard
Now the author already describes nicely the requirements and dependencies of the script, however, I really get tough time trying to creat an environment via conda
$ conda create -n py27 python=2.7 anaconda
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working...
now it has been solving the environment forever now, and I seem not to be the only one suffering,
honstly, I think that PIP and VENV are still the best, and I can't understand the use of a script when I must understand all the dependencies and packages to run it one single time, it would have been easier to write it from the beginning!
also I think when a script has so many dependencies, efforts should be done to compile that , that's why compiling is for,
anyway, I will need help in creating an environment using conda without waiting for 6h or more ..
I must be doing something not smart, and I don't want to work hard!
thanks if you decide to help!
Consider trying
conda create -n py27 python=2.7
without the anaconda at the end.
If you still try to create the environment with a file say requirements.txt, as I tried... I was having an issue where Anaconda Navigator will stay loading the file forever, with no errors. I ended up creating the environment using the following command.
Hope this works for any OCD person like me that was trying to learn how to create an environment from the requirements.txt
(MAKE SURE THE FILE IS IN THE SAME DIRECTORY)
conda create --name my-env-name --file requirements.txt

Anaconda install packages without connection

I am trying to install packages for anaconda offline
I am behind a company network, i have no possibilities to use conda install or pip install, I also cant create and custom environment.
I have already downloaded plotly....tar.gz and others.
Is there any way to install packages completly offline?
conda install C:/Users/xxxxx/Desktop/python packages/plotly-4.5.0.tar.gz --offline
I already tried some manuals but i get errors like
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
Current channels:
https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
https://conda.anaconda.org/conda-forge/win-64
https://conda.anaconda.org/conda-forge/noarch
Any help would be very nice
Solved! This is working behind a company proxy. Here with plotly as example
download package from https://repo.continuum.io/pkgs/main/noarch/
example: plotly-4.4.1-py_0.tar.bz2
safe package to C:/Temp/noarch/ folder (if it doesn't exist, create it)
in C:/Temp/noarch/ folder press shift + rightclick (open console) or use anaconda prompt and go to folder
type in
conda install plotly-4.4.1-py_0.tar.bz2 (other: conda install “package”)
example: C:\Temp\noarch>conda install plotly-4.4.1-py_0.tar.bz2

Collecting package metadata (repodata.json): failed

I get this error:
Collecting package metadata (repodata.json): failed
I tried to reinstall anaconda again and again as well as windows 10 but no result...
can you help me to fix this issues...
thank you
I was issuing this when updating pandas inside a HDICluster. This is a known issue with Conda 4.7.11. The solution which works for me was running the follow lines, as described at MDN
rm /usr/bin/anaconda/lib/python2.7/site-packages/conda/core/subdir*
wget https://gregorysfixes.blob.core.windows.net/public/subdir_data.py -P /usr/bin/anaconda/lib/python2.7/site-packages/conda/core/
I am not sure, but I think update anaconda can work too. To update anaconda:
conda update -n base conda

How can I get conda to resolve package dependencies in a local channel correctly?

I want to set up anaconda with tensorflow on an offline pc. But I am having trouble installing packages because dependencies are not resolved correctly.
On my online Windows10 pc I've installed anaconda and installed tensorflow in a separate environment. I downloaded all the packages and copied them to the offline Windows10 pc in a win-64 directory and indexed using conda index. I added the local directory as a channel to the available channels and have set conda to work offline.
I was able to update the local anaconda version using conda update conda from this channel and also to update all the packages available in the local channel. I then proceeded to create a channel with python=3.6.
However, when I then try conda install tensorflow-gpu I get the 'PackagesNotFoundError', saying that TF is dependent on other packages:
Collecting package metadata: done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- tensorflow-gpu -> tensorflow==1.13.1 -> tensorboard[version='>=1.13.0,<1.14.0'] -> grpcio[version='>=1.6.3'] -> openssl[version='>=1.1.1,<1.1.2.0a0']
- tensorflow-gpu -> tensorflow==1.13.1 -> tensorflow-base==1.13.1=gpu_py36h871c8ca_0
These packages are available, in the right version and build in the local channel and conda search lists them correctly.
It gets more peculiar:
I can install openssl en grpcio from file in my environment and have installed exactly the same version and build as on my online pc. However,
if I then try to install tensorflow-base conda gives:
Collecting package metadata: done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- tensorflow-base=1.13.1 -> grpcio[version='>=1.8.6'] -> openssl[version='>=1.1.1,<1.1.2.0a0']
Eventhough conda list lists them correctly (versions 1.16.1 and 1.1.1b) with the same builds as on my online pc.
So: I expected to able install tensorflow with its dependencies from the local package repository but are unable to do so. I also expected to be able to install the dependencies by hand and then be able to install tensorflow
but I still get PackagesNotFoundError.
I do not think this is a Tensorflow specific problem. But I've run out of ideas what to try next.
Any help on how to configure/force conda to install these packages would be greatly appreciated.

Resources