简体   繁体   中英

How to install ipywidgets offline (from file)

So I am trying to install ipywidgets-0.0.1 into my Anaconda environment. I am running Anaconda3. Unfortunately, the machine I need to install it on does not have internet access.

The basic way to install the package is to run conda install ipywidgets , but of course this gives the following error:

Fetching package metadata: Could not connect to https://repo.continuum.io/pkgs/p
ro/noarch/
Could not connect to https://repo.continuum.io/pkgs/free/win-64/
Could not connect to https://repo.continuum.io/pkgs/pro/win-64/
.Could not connect to https://repo.continuum.io/pkgs/free/noarch/
...
Solving package specifications: .
Package plan for installation in environment C:\Program Files\Anaconda3:

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ipywidgets-0.0.1           |       np19py34_0           7 KB

The following NEW packages will be INSTALLED:

    ipywidgets: 0.0.1-np19py34_0

Proceed ([y]/n)? y

Fetching packages ...
Could not connect to https://repo.continuum.io/pkgs/free/win-64/ipywidgets-0.0.1
-np19py34_0.tar.bz2
Error: Connection error: HTTPSConnectionPool(host='repo.continuum.io', port=443)
: Max retries exceeded with url: /pkgs/free/win-64/ipywidgets-0.0.1-np19py34_0.t
ar.bz2 (Caused by ProtocolError('Connection aborted.', gaierror(11004, 'getaddri
nfo failed'))): 
https://repo.continuum.io/pkgs/free/win-64/ipywidgets-0.0.1-np19py34_0.tar.bz2

This makes sense, since the box can't access the internet. I downloaded the ipywidgets tarball from the listed URL at https://repo.continuum.io/pkgs/free/win-64/ipywidgets-0.0.1-np19py34_0.tar.bz2 , and I ssh'ed it onto the box.

What command can I run on the box (it is a Windows 7 environment) so that it will run the install as local, looking at the downloaded tarball to unpack rather than trying to access the internet to get the file?

Download the whole package and its dependencies to some local directory You can get it from PYPI ipywidgets

Let's consider you donwloaded from PYPI and you have ~/src/ipywidgets with ~/src/ipywidgets/setup.py which will have install_requires with a list of dep. in your /pypi directory. Like so:

install_requires=['hello', 'etc', ...]

To install your app and its dep. into the current python env., you've to do something like:

$ cd ~/src/ipywidgets
$ easy_install --always-unzip --allow-hosts=None --find-links=/pypi

Note that the build will fail if one or more dependencies are missing

If you want to use conda for this, might as well if you are already using anaconda, you should also be able to do:

conda install --offline PATH_TO_FILE/ipywidgets-0.0.1-np19py34_0.tar.bz2

Where, of course, PATH_TO_FILE is just the path to the file you've downloaded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM