How to install ipywidgets offline (from file) - python

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.

Related

LDAP installation for Python without Pip and .org's

i want to use LDAP with python and dont have the opportunity to use pip with pypi.python.org, pypi.org and files.pythonhosted.org. (cant get through Proxy, wont change)
so i need to download the package and install it.
as i understand there are .whl and zipped packages.
i tried bonsai but got the error C1083 because of the missing file basetsd.h
i tried python_ldap but it called for pyasn1, so i tried to install pyasn1 but it gave me a 407 Proxy Authorization Required -- Some packages may not be found Line with Error "Could not find suitable distribution for Requirement.parse('pyasn1<0.5.0,>=0.4.6')
There where no red or yellow errors so i tried python_ldap again, but with the same error like on the first attempt.
how do i setup a LDAP for Python if i cant reach pypi.python.org, pypi.org and files.pythonhosted.org ?
Greetings
Chorum
Python: 3.10.1
Pip: 21.2.4

Installing requests package breaks anaconda installation

I'm having an issue where when I install the requests package on a fresh anaconda install (onto an environment), it breaks my anaconda in a way where I cannot download any further packages due to an HTTP error.
The process I've gone through a number of times now is:
Uninstall anaconda (using anaconda-clean and add/remove programs)
Re-install anaconda
Run conda update conda on my base environment
Run conda create -n auckland-index python=3.7 to create a new environment
I install pandas with conda install pandas to make sure I can download packages in the new environment
I then run conda install requests to install requests, which downloads and installs successfully
Then when I try to install any other packages I get the below CondaHTTPError across both base and new environments
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/current_repodata.json>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.
'https://repo.anaconda.com/pkgs/main/win-64'
I have tried installing requests before pandas and after other packages, but I get an CondaHTTPError always after installing requests.
I have tried the following from other stack questions to fix (of which none work):
Set ssl_verify: false in .condarc
Copy both libcrypto-1_1-x64.dll and libssl-1_1-x64.dll to the anaconda3/DLLs folder
I'm at a bit of a loss as to why installing requests is causing this issue, as I'm downloading it through the conda install command. This isn't a network issue either as the downloading and installing of packages was working before requests was installed. Once I have installed requests I cannot download any more packages for any environment.
Has anyone had this issue or know of a fix? Is this a bug?
EDIT: from each environment I have run conda list requests and python -c "import requests; print(requests.__spec__)", with the results below.
Base
# Name Version Build Channel
requests 2.22.0 py37_0
ModuleSpec(name='requests', loader=<_frozen_importlib_external.SourceFileLoader object at 0x00000284138E7FC8>, origin='%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\requests\\__init__.py', submodule_search_locations=['%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\requests'])
auckland-index
# Name Version Build Channel
requests 2.25.1 pyhd3eb1b0_0
ModuleSpec(name='requests', loader=<_frozen_importlib_external.SourceFileLoader object at 0x00000284138E7FC8>, origin='%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\requests\\__init__.py', submodule_search_locations=['%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\requests'])
EDIT 2: Adding path variables from base environment
['', '%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\python37.zip',
'%USERPROFILE%\\open-data-api',
'%USERPROFILE%\\Auckland-Index-Update',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\DLLs',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index',
'%USERPROFILE%',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\locket-0.2.1-py3.7.egg',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\win32',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\win32\\lib',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\Pythonwin',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\envs\\auckland-index\\lib\\site-packages\\IPython\\extensions',
'%USERPROFILE%\\.ipython',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\python37.zip',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\DLLs',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\lib',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\win32',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\win32\\lib',
'%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\Pythonwin']
Issue was caused by PYTHONPATH windows environment variable, once this was deleted problem was solved. Thanks to #merv for help getting there.

Install anaconda library from a local source

I have been trying to install pymc for some time on a Windows PC behind a very complicated proxy; effectively making this an installation on a computer not connected to the internet. I have tried - unsuccessfully - to set a proxy in the condarc file but I still get error messages
conda install -c https://conda.binstar.org/pymc pymc
Fetching package metadata: SSL verification error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)
To solve this, you need to download the tar file (even if using Windows) that the installer is trying to fetch and then use offline mode:
Use this command (which will throw an error), to determine the file to be downloaded:
>conda install -c https://conda.binstar.org/pymc pymc
Fetching package metadata: SSL verification error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)
....
Solving package specifications: ......................
The following packages will be downloaded:
package | build
---------------------------|-----------------
pymc-2.3.5 | np110py35_0 402 KB defaults
The following NEW packages will be INSTALLED:
pymc: 2.3.5-np110py35_0 defaults
Proceed ([y]/n)? y
Fetching packages ...
Could not connect to https://repo.continuum.io/pkgs/free/win-64/pymc-2.3.5-np110py35_0.tar.bz2
... [error message continues]...
Now download the tar file mentioned in the error message:
https://repo.continuum.io/pkgs/free/win-64/pymc-2.3.5-np110py35_0.tar.bz2
And then run this command with the path to the tar file:
>conda install --offline C:\pymc-2.3.5-np110py35_0.tar.bz2
Just of notes: "-c conda-forge" might be handy for some other packages. For example:
conda install -c conda-forge python-levenshtein
Adding to the solution above. Anyone met "SSL verification error" can just turn the verification step off temporarily in ~/.condarc
channels:
- defaults
ssl_verify: true
In this way, you could install from your local hub.
I was not able to run offline installation in Anaconda (on Win10) because Anaconda always tried to connect to remote channels or collecting metadata process failed.
To solve this I had to:
Download requested module as bz2 file (or convert tar.gz into tar.bz2)
Run Anaconda prompt (ev. navigate to folder with bz2 file)
Run offline installation with conda install path-to-bz2, i.e conda install zeep-4.0.0.tar.bz2

Installing Python devel on centos

bash-4.1# yum install python-devel
Loaded plugins: fastestmirror, rhnplugin
This system is receiving updates from RHN Classic or RHN Satellite.
Loading mirror speeds from cached hostfile
* rpmforge: mirror.smartmedia.net.id
* webtatic-el5: uk.repo.webtatic.com
http://192.168.210.26/centos/6/updates/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package python-devel.x86_64 0:2.6.6-36.el6 will be installed
--> Processing Dependency: python(x86-64) = 2.6.6-36.el6 for package: python-devel-2.6.6-36.el6.x86_64
--> Finished Dependency Resolution
Error: Package: python-devel-2.6.6-36.el6.x86_64 (centos64-x86_64)
Requires: python(x86-64) = 2.6.6-36.el6
Installed: python-2.6.6-37.el6_4.x86_64 (#centos64-updates-x86_64)
python(x86-64) = 2.6.6-37.el6_4
Available: python-2.6.6-36.el6.x86_64 (centos64-x86_64)
python(x86-64) = 2.6.6-36.el6
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
Can somebody help me with above error , I am getting.
Just to let everybody know I am trying to install cx_Oracle on my CentOS system (CentOS release 6.4) and I got this error:-
error: command 'gcc' failed with exit status 1
So, I searched and found out to install python-devel and to do that I am getting the above error.
You have a newer version of python installed than the corresponding source package you're trying to install.
You have python 2.6.6-37 installed but the latest available source package from your repos (that you can successfully connect to) is 2.6.6-36.
But it looks like the python you have installed came from your "updates" repo,
http://192.168.210.26/centos/6/updates/i386/repodata/repomd.xml which isn't working at t he moment.
If that repo also had the corresponding python-devel-2.6.6-37 package, and it worked, (didn't throw a PYCURL error) you'd be fine, yum would find that and use it.
So your first step should be fixing your LAN repo / mirror.

Building packages with conda and python3k

So I'm building a package with conda on Win7:
conda skeleton pypi $pkgname
conda build $pkgname
binstar upload ./conda-bld/win-64/$pkgname-py27_0.tar.bz2
conda install -c https://conda.binstar.org/myname $pkgname
With python2k, this works like a charm. However, using python3k this fails because the patch package is not available for python3k. Error (example for docopt):
$ conda skeleton pypi docopt
Using url https://pypi.python.org/packages/source/d/docopt/docopt-0.6.2.tar.gz (25 KB) for docopt.
Downloading docopt (use --no-download to skip this step)
Using cached download
Unpacking docopt...
done
working in C:\cygwin64\tmp\tmpy7erx8vyconda_skeleton_docopt-0.6.2.tar.gz
Fetching package metadata: ......
Solving package specifications: .
Applying patch: 'C:\\cygwin64\\tmp\\tmpy7erx8vyconda_skeleton_docopt-0.6.2.tar.gz\\pypi-distutils.patch'
Error:
Did not find 'patch' in: C:\Python\Anaconda3\envs\_build\Scripts;C:\Python\Anaconda3\Scripts;C:\cygwin\bin;C:\cygwin64\usr\local\bin;C:\cygwin64\bin;C:\Python\Python3\Lib\site-packages\PyQt4;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\MiKTeX 2.9\miktex\bin\x64;C:\cygwin64\bin;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\Python\Anaconda3;C:\Python\Anaconda3\Scripts;C:\cygwin64\lib\lapack
You can install 'patch' using apt-get, yum (Linux), Xcode (MacOSX), or conda, cygwin (Windows)
When trying to install patch:
$conda search ^patch$
Fetching package metadata: ....
patch 1.12.11 py27_0 defaults
No patch package for python3k - does this mean no package building for me?
You can reuse the same recipe that you built with Python 2. Or you can create an environment with patch (conda create -n patch patch) and put it on your PATH. Or you can install patch from http://gnuwin32.sourceforge.net/packages/patch.htm.

Categories