Installing python library dependency without Internet available [duplicate] - python

This question already has answers here:
How to install packages offline?
(12 answers)
Closed 4 years ago.
I am trying to install the following package (SignXML) on Windows Server 2012: https://pypi.org/project/signxml/
I am running Python 2.7.14, it's an isolated server which is only accessible within Intranet and has all outbound connections blocked.
I've downloaded tar.gz of that package and executed: "pip install signxml-2.6.0.tar.gz".
It started installation but I get error:
Retrying (Retry(total=4, connect=None, read=None, redirect=None))
after connec tion broken by
'ConnectTimeoutError(, 'Connection to
pypi.python. org timed out. (connect timeout=15)')': /simple/lxml/
I am no expert with Python but I assume based on error that it attempts to retrieve some dependancy from pypi but fails as the outbound connections are blocked.
Is there a way to see all dependencies for that project (SignXML) and manually download them as tar.gz archives and then somehow manually install them or tell SignXML install to use local files instead of fetching them from Pypi?

I can understand you want to install signxml without internet as you downloaded .tar.gz file. But it requires some other dependencies too.
As per documentation https://pypi.org/project/signxml/
You will need to install other packages as - lxml, defusedxml, cryptography, eight, pyOpenSSL.
Please refer the documentation carefully.!

I don't think it's possible to be honest. Whether the file is a tar.gz, a .whl, or a straight up install call (like pip install pygame), it downloads it from the internet. The only way I could think of doing offline, is by extracting the contents you have and placing them in the
[python install dir]/Lib/site-packages
directory in it's own folder.

In the setup.py file of the package are the required packages listed. You probably need to install all of them manually.

Related

pip errors out with SSLError [X509] PEM lib (_ssl.c:4264) [Win10]

I can't update anything/install anything new using pip, the following error keeps occurring:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(9, '[X509] PEM lib (_ssl.c:4264)'))': /simple/<package>
I can install using the extended command
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package_name>
and I updated and force reinstalled my certifi package using this.
I thought it was a CA cert issue but, this didn't change anything with the normal command.
What's going wrong? (and how do I fix it?)
Update: I tried this before as well as mentioned in the question, but force-reinstalling certifi using the long command (with trusted hosts) solved it.
I cannot understand how it did not work when I asked the question.
One thing I can see being the problem is that when I did this the other day, it installed the most recent version of certifi at that time, which would be 2021.05.xx (may 2021 basically).
However, when it reinstalled today, it installed version 2021.10.8 (8th Oct 2021); which means a new update was released yesterday.
I wonder if I had installed an outdated/previous version (basically not the same version as 2021.05.xx), would it have worked?

pip install has SSL issue in virtualenv with interperter of python27

TL;DR
Trying to use pip install within a python27 venv and got SSL connection error.
I am very new to python development. With the advent of python 3 and all the compatibility issues it introduced, I never felt so lost with so many python 2 codes and documentations active along with python 3 documentations.
So I am working with a python web app (flask based) which should be running on python 2.7.
I am running windows 10 with VS Code.
So I have done all the steps to create a venv folder under my project with the cmd virtualenv -p "C:\\Python27\python.exe" venv
When I start doing the pip install -r requirements.txt
I am getting following connection error.
c:\users\path\to\project\venv\lib\site-packages\pip_vendor\urllib3\util\ssl_.py:354:
SNIMissingWarning: An HTTPS request has been made, but the SNI (Server
Name Indication) extension to TLS is not available on this platform.
This may cause the server to present an incorrect TLS certificate,
which can cause validation failures. You can upgrade to a newer
version of Python to solve this. For more information, see
https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecurePlatformWarning
Retrying (Retry(total=4, connect=None,
read=None, redirect=None, status=None)) after connection broken by
'SSLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL
routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)':
/simple/pip/
c:\users\kenzho~1\worksa~1\7eleve~1\venv\lib\site-packages\pip_vendor\urllib3\util\ssl_.py:150:
InsecurePlatformWarning: A true SSLContext object is not available.
This prevents urllib3 from configuring SSL appropriately and may cause
certain SSL connections to fail. You can upgrade to a newer version of
Python to solve this. For more information, see
https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
I have tried following ways to address the issue.
python -m pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org --index-url=https://pypi.org/simple/
But none of them seems to work.
Any body got any idea?
Thanks
You need to update your Python SSL packages.
Option 1
Installing the following packages will fix the errors.
pip install pyOpenSSL ndg-httpsclient pyasn1
But this will only work for the system version of Python 2.7.6.
For some reason trying the same fix with a python in a virtual env fails hard. You end up not being able to complete the update because of the SSL error you are trying to fix.
Option 2
Upgrade your version of python. The fixes you need have been bundled into Python 2.7.9
Details of the error and fix are in the release notes.

How to install python pip in aarch64/armv8 platform? [duplicate]

This question already has answers here:
Installing pip using easy_install
(6 answers)
Closed 4 years ago.
I have a board which is powered by Linux kernel. The board is of aarch64/armv8 architecture. The board does not have apt-get but has easy_install. I tried to install using easy_install, I got the following error,
root#armboard:~# easy3_install pip
Searching for pip
Reading https://pypi.python.org/simple/pip/
Download error on https://pypi.python.org/simple/pip/: [Errno -2] Name or service not known -- Some packages may not be found!
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: [Errno -2] Name or service not known -- Some packages may not be found!
No local packages or working download links found for pip
error: Could not find suitable distribution for Requirement.parse('pip')
root#armboard:~# easy3_install --version
setuptools 36.2.7 from /usr/lib/python3.5/site-packages (Python 3.5)
Please suggests ways to install pip in this platform.
If it is possible with easy_install what steps should I follow to get ride of this error?
If not shall I get cross compiled pip binaries for this architecture or any Yocto build is available?
If easy_install pip doesnt work, you can try to build the source.
https://archlinuxarm.org/packages/aarch64/python-pip

install numpy and pandas on 1and1 shared hosting python

I've installed python 2.7.14 on my 1and1 shared hosting server using the following tutorial: http://geeksta.net/geeklog/python-shared-hosting/
it works and has a bunch of the modules that I use. However, i'd like to have numpy and pandas on this installation as well.
I'm having all sorts of issues, but the most basic one is when typing:
pip install numpy
which leads to the following error:
Could not fetch URL https://pypi.python.org/simple/numpy/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy
So it looks like maybe it's failing because I don't have SSL installed, but all the suggestions for installing SSL seems to require sudo (which I can't access root on a shared host).
A second question is that I'm wondering about is if I need to use a virtualenv or not. I'm new to this but it seems like it will allow me to install things, but again I tried to install virtualenv (as stated in the tutorial):
pip install virtualenvwrapper
but I get the same sort of SSL error:
Could not fetch URL https://pypi.python.org/simple/virtualenvwrapper/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
Could not find a version that satisfies the requirement virtualenvwrapper (from versions: )
No matching distribution found for virtualenvwrapper
any help that can direct me in the right direction to get these modules installed would be greatly appreciated. Thanks.
Updated to ask additional approach Given the issue seems to be not being able to download a python package on a https site (b/c SSL isn't available), is it possible for me to download the package manually using my webbrowser then FTPing the file into my server filesystem and then using SSH commands to install the modules? If so, any tips would be much appreciated.
Okay, I finally figured it out. Basically, downloading each package manually from their various websites and ftp-ing them to the shared host and then unzipping and installing them manually is what worked for me. This avoids having to connect to an SSL site to download the file on the shared host.
for numpy:
I downloaded the source file (numpy-1.14.2.zip) for numpy from here: https://pypi.org/project/numpy/#files
FTP that to the python folder in my shared host.
unzipped it
unzip numpy-1.14.2.zip
then ran setup.py from inside the numpy-1.14.2 folder
python setup.py install
Then I repeated this for pandas and it's dependencies:
setuptools
NumPy: 1.9.0 or higher
python-dateutil: 1.5 or higher
pytz: Needed for time zone support

How can I make PyCharm ignore SSL errors when installing libraries?

I am trying to install the requests library to my Python environment in PyCharm while on a company network that uses self-signed SSL certificates. As a result, installing a library with File > Settings > Project > Project Interpreter > Install fails with an HTTPS error:
Collecting requests
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection
broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x0368D5D0>: Failed to establish a new connection:
[Errno 11003] getaddrinfo failed',)': /simple/requests/
Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests
I tried making pip trust my company's root certificate by adding --cert C:\COMPANY-CAROOT.pem to my install options, which was interpreted as:
pip install --cert C:\COMPANY-CAROOT.pem requests
I also tried opening File > Settings > Project > Server Certificates and checking Accept non-trusted certificates automatically, but ran into the same issue.
How can I get PyCharm to ignore SSL certificate errors when installing external libraries?
I faced the same issue. The way I resolved it was by adding all the packages I wanted to install in a .txt file, e.g. requirements.txt containing all the package-names and their versions.
Then from the Terminal (can also be the PyCharm Terminal), I did:
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org -r requirements.txt
The key here is the use of --trusted-host. Adding the packages in a file is just for convenience.
Alternatively you can create a pip.ini file and add the trusted hosts there.

Categories