Create a conda environment offline
I found a way to get my code working without dependency issues, which is to clear the pythonpath variable, and then make it point to the python of Anaconda like so :export PYTHONPATH="~/anaconda2/bin/python"
.
This way I have no import problems on the remote machine with no internet connection (since I mainly use libraries already in anaconda)
Maybe this link can be helpful to others who want to create a conda environment offline using channels ;)
Conda environment from .yaml offline
If you can use pip to install the packages, you should take a look at devpi
, particutlarily its server. devpi
can cache packages normally installed from PyPI, so only on first install it actually retrieves them. You have to configure pip
to retrieve the packages from the devpi server.
As you don't want to list all the packages and their dependencies by hand you should, on a machine connected to the internet:
- install the devpi server (I have that running in a Docker container)
- run your installation
- examine the devpi repository and gathered all the
.tar.bz2
and.whl
files out of there (you might be able to tar the whole thing)
On the non-connected machine:
- Install the devpi server and client
- use the devpi client to upload all the packages you gathered (using
devpi upload
) to the devpi server - make sure you have pip configured to look at the devpi server
- run
pip
, it will find all the packages on the local server.
devpi
has a small learning curve, which already worth traversing because of the speed up and the ability to install private packages (i.e. not uploaded to PyPI) as a normal dependency, by just generating the package and upload it to your local devpi server.
Conda Environment Offline Creation
Here is a quick patch:
--- subdir_data.py 2018-10-19 19:51:42.955004287 +0200
+++ subdir_data_.py 2018-10-19 19:47:09.193646000 +0200
@@ -189,6 +189,7 @@
'_package_dists': (),
'_names_index': defaultdict(list),
'_track_features_index': defaultdict(list),
+ 'repodata_version': 0,
}
else:
mod_etag_headers = {}
Install conda package locally from other local environment
If it's in the package cache (i.e., in conda config --show pkgs_dirs
), then you can install it with conda install --offline pkg_name
. Also check if the tarball is still downloaded - that would be a natural archive, and one can directly install from a tarball (e.g., conda install path/to/pkg_name.tar.bz2
).
Related Topics
How to Locate Elements on Webpage With Headless Chrome
Check If Dataframe Has a Zero Element
Python | Make the Percentage of a List
Winerror 10049: the Requested Address Is Not Valid in Its Context
How to Solve and Equation With Inputs in Python
How to Call a Classes Method from Another Class Without Initialising the First Class
Python Executable Not Finding Libpython Shared Library
Finding the Value of the Min and Max Pixel
Overlay a Smaller Image on a Larger Image Python Opencv
Possible to Get User Input Without Inserting a New Line
How to Download Outlook Attachment from Python Script
Convert HTML String to an Image in Python
Changing Presence Discord Status