Anaconda install packages without connection - anaconda

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

Related

conda creation NGS environment, sra-tools fastqc multiqc samtools bowtie2 hisat2 subread

I cannot easily create an environment with conda containing the NGS tools I want. I reinstalled conda to get a fresh start since I had many python packages in the base env. I also took the occasion to install the full anaconda3 instead of miniconda I had before now I have way enough space.
Although all the packages are available via bioconda the only 2 i can add to my env are fastqc and multiqc. Before that I could install sra-tools and fastqc in the base env with miniconda3.
Config: MacOS Monterey 12.1 M1 chip. migration from my old macbook air with the lastest time machine bkp. I uninstalled miniconda with the anaconda-clean procedure and after that I also removed a python 3.9.5 I had in the apps folder I had initially installed to start learning 1yr ago before knowing about conda.
Also to be mentioned in case it may help: anaconda-navigator was not installed by the Anaconda3-2022.05-MacOSX-arm64.pkg (sha256 integrity check was ok)
in following the check installation/navigator troubleshooting on anaconda website I came across an error upon launching spyder:
```(ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets')```
Does somebody know where this unability to find the packages comes?
Thank you for your help!
best, Daniel
Env creation command and console output:
(base) mymac:~ D________$ conda create --name ngstools fastqc multiqc sra-tools samtools bowtie2 hisat2 subread -c conda-forge -c bioconda -c bioconda/label/cf201901
Terminal output:
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: failed
PackagesNotFoundError: The following packages are not available from current channels:
hisat2
subread
bowtie2
samtools
sra-tools
Current channels:
https://conda.anaconda.org/conda-forge/osx-arm64
https://conda.anaconda.org/conda-forge/noarch
https://conda.anaconda.org/bioconda/osx-arm64
https://conda.anaconda.org/bioconda/noarch
https://conda.anaconda.org/bioconda/label/cf201901/osx-arm64
https://conda.anaconda.org/bioconda/label/cf201901/noarch
https://repo.anaconda.com/pkgs/main/osx-arm64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/osx-arm64
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.
Prefatory Comments
That is not a configuration I would recommend to bioinformatics users with M1 machines at the moment. There is no support yet for osx-arm64 in Bioconda. I expect one would find the least configuration issues by having everything in emulation (osx-64) from the base. Or you can continue with the osx-arm64 base (as you have now), but create new environments with the subdir setting. The answer below shows steps in this direction.
Also, I would very much avoid Anaconda/Miniconda. Mambaforge base is what I recommend to all bioinformaticians. And set the Bioconda channels globally.
Lastly, only advanced users should use channel labels (e.g., bioconda/label/cf201901). I realize they automatically show up on Anaconda Cloud, but they are only ever applicable in specialized circumstances, which most users will never encounter.
Immediate workaround
If you want to keep the osx-arm64 base, then you'll need to create a osx-64 environment for the NGS tools. I recommend the following protocol for best practice:
## create empty environment
conda create -n ngstools
## activate environment
conda activate ngstools
## configure architecture
conda config --env --set subdir osx-64
## configure channels for Bioconda
conda config --env --add channels defaults
conda config --env --add channels bioconda
conda config --env --add channels conda-forge
## install packages
conda install fastqc multiqc sra-tools samtools bowtie2 hisat2 subread
It's convoluted and, until osx-arm64 sees full support, you'd have to do this for every environment that requires emulation and Bioconda. Hence, why I recommend instead that you reinstall a osx-64 base (Mambaforge), which would just work.

How can I make anaconda automatically install jupyterlab extensions in every new environment I create?

I would like to have the exact same setup of jupyterlab in every new anaconda environment. Just like I can define some default packages to be installed when creating an environment with
conda config --add create_default_packages package1 package2
I would like to install a few jupyterlab extensions. I can install them by using the command
jupyter labextension install,
but this is a jupyterlab command and not a conda one. Is there a way of creating a script, that would execute only once after creating an environment, or some other mechanism that would let me automate this process?
With JupyterLab 3+.0+ you should not need to install extensions with jupyter labextension install; instead installation with pip install or conda install is now the recommended approach for most users (see documentation).
Extensions installable with pip/conda* do not require Node.js and are therefore more robust and user-friendly; we call them "prebuilt extensions", in contrast to the old "source extensions". We are considering removing support for installing source extensions by end users in a future version of JupyterLab (but not for advanced users and system administrators who should still be able to access this mechanism) as source extensions proved to be causing more trouble than benefit for an average user, and users so far were happy with the transition.
Please also see:
Unable to install jupyterlab-execute-time extension
RuntimeError: JupyterLab failed to build
If extension is not on conda-forge you can always contribute a recipe for it. If that's the case let me know and I can help you with the next steps.
*) or any other package manager which is able to place a .js file in appropriate location - this is not limited to Python ecosystem

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

Conda install local package fails

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

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