Build python project as package without internet access - python

I have a python project I want to package. I can package the project with python -m build just fine when connected to the internet.
When I disconnect and try the same command, I get an error about pip being unable to find the package wheel:
(my-venv) [me#my-host my-project]$ python -m build
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools>=42, wheel)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f5935bb4f10>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/wheel/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f5935b5a160>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/wheel/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f5935b5a310>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/wheel/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f5935b5a4c0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/wheel/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f5935b5a670>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/wheel/
ERROR: Could not find a version that satisfies the requirement wheel
ERROR: No matching distribution found for wheel
This happens even if I install setuptools and wheel first.
How can I build my project without needing internet access at the time of building? Can I somehow make the isolated environment use my python cache?

Related

Failed to establish a new connection in wsl when i use pip install

I want to install flask-sqlalchemy within the virtual environment on my ubuntu subsystem (WSL) on Windows 11, using the following command:
pip install flask-sqlalchemy
however i recieve an error in console window.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7ff5c27dff10>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flask-sqlalchemy/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7ff5c2620280>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flask-sqlalchemy/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7ff5c2620520>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flask-sqlalchemy/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7ff5c26206d0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flask-sqlalchemy/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7ff5c2620880>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flask-sqlalchemy/
ERROR: Could not find a version that satisfies the requirement flask-sqlalchemy (from versions: none)
ERROR: No matching distribution found for flask-sqlalchemy
I think it is related with network connection in my Ubuntu subsystem. I try on Standalone Linux system and it seems to be work. How i can solve this issue?
i finnaly resolve my issue. I post below steps to solve this problem.
I checked my fireewall settings. It was not an issue.
i dont use proxy so i skipped the proxy issue.
i checked ping from the console window
ping google.com
it displayed
ping: google.com: Temporary failure in name resolution
I found a solution. Seems like my DNS server can't find an address associated to the URL i am passing. I got errors because the resolv.conf file was not set up in my Ubuntu Subsystem.
solution:
in wsl Ubuntu Linux type commamnd
sudo nano /etc/resolv.conf
add nameserver and save file
nameserver 8.8.8.8

A pip subprocess error when I create an environment for one project in its root folder

Running Ubuntu 18.04 LTS as WSL2 on Win10, I need to create an environment to install Devito on my system. So, in a root folder of this project I do:
(base) quant#NB-W-I-NIKONENKO:~/devito$ conda env create -f environment-dev.yml
and get this:
Collecting package metadata (repodata.json): done
Solving environment: done
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Installing pip dependencies: \ Ran pip subprocess with arguments:
['/home/quant/anaconda3/envs/devito/bin/python', '-m', 'pip', 'install', '-U', '-r', '/home/quant/devito/condaenv.r9s6c4x4.requirements.txt']
Pip subprocess output:
Requirement already satisfied: pip>=9.0.1 in /home/quant/anaconda3/envs/devito/lib/python3.9/site-packages (from -r /home/quant/devito/requirements.txt (line 1)) (21.2.4)
Pip subprocess error:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f27c959d970>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/pip/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f27c959d5b0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/pip/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f27c959df10>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/pip/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f27c95c5100>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/pip/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f27c95c52b0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/pip/
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f27c8f2bc10>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/numpy/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f27c8f2be20>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/numpy/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f27c8f32040>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/numpy/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f27c8f321c0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/numpy/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f27c8f32370>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/numpy/
ERROR: Could not find a version that satisfies the requirement numpy>1.16 (from versions: none)
ERROR: No matching distribution found for numpy>1.16
failed
CondaEnvException: Pip failed
The next installation commands should be:
source activate devito
which works, and the next:
pip install -e .
which shows the following:
Obtaining file:///home/quant/devito
Requirement already satisfied: pip>=9.0.1 in /home/quant/anaconda3/envs/devito/lib/python3.9/site-packages (from devito==4.6.2+60.g9b765d0d6) (21.2.4)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa7509e1040>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/numpy/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa750a4d9d0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/numpy/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa750a4d880>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/numpy/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa750a4d190>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/numpy/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fa750a4dca0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/numpy/
ERROR: Could not find a version that satisfies the requirement numpy>1.16 (from devito) (from versions: none)
ERROR: No matching distribution found for numpy>1.16
So, I can not install the package correctly and implement the final command:
conda update - all –yes
I noticed that base Python version is 3.7.6 and after the source activation python version is 3.9.7 (I am not sure if it helps but I really struggled with this problem).
Here is the link for installation instructions for the Devito
https://medium.com/#soulfoodpst/install-devito-on-windows-a-tool-for-automatic-programming-3def3949e5c8

Fix " Could not find a version that satisfies the requirement boto3 (from versions: ) No matching distribution found for boto3"

I'm struggling installing installing Boto3 library.
Python version: 3.6.12
pip version 9.0.1
Server: Redhat 7.9 (Maipo) , Fedora.
I tried different comibnation to get the boto3 library:
pip3 install boto3
pip3 install boto
pip3 install --extra-index-url https://pypi.python.org/simple boto3
but always I have the same error.
Any idea?
My code:
sla82716:/home/pa009999/scriptDirectory $ pip3 install boto
Collecting boto
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f8fb0f74e10>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/boto/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f8fb0f74208>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/boto/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f8fb0f742b0>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/boto/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f8fb0f74320>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/boto/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f8fb0f743c8>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/boto/
Could not find a version that satisfies the requirement boto (from versions: )
No matching distribution found for boto
sla82716:/home/pa009999/scriptDirectory $ pip3 install boto3
Collecting boto3
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f08a5642f98>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/boto3/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f08a5642438>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/boto3/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f08a5642400>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/boto3/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f08a56420b8>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/boto3/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f08a5642630>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/boto3/
Could not find a version that satisfies the requirement boto3 (from versions: )
No matching distribution found for boto3
sla82716:/home/pa009999/scriptDirectory $ pip3 install --extra-index-url https://pypi.python.org/simple boto3
Collecting boto3
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5456b85358>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/boto3/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5456b85828>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/boto3/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5456b85898>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/boto3/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5456b85ef0>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/boto3/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5456b85198>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/boto3/
Could not find a version that satisfies the requirement boto3 (from versions: )
No matching distribution found for boto3
It looks like you cannot resolve the hostname. Try adding the following line (Google nameserver)
nameserver 8.8.8.8
to the /etc/resolv.conf file (e.g., by using nano /etc/resolv.conf). You can only add three nameservers, so you might have to delete/change one line if there are already three nameservers in the file.
Afterwards, ping google.com should work and pip install boto3 as well.

pip install error - Could not install packages due to an EnvironmentError

I have the following error message when I try to install anything with pip. Here I want for instance to upgrade pip:
$ pip install --upgrade pip
Collecting pip
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7febc7ffe810>: Failed to establish a new connection: [Errno -2] Nom ou service inconnu')': /packages/5a/4a/39400ff9b36e719bdf8f31c99fe1fa7842a42fa77432e584f707a5080063/pip-20.2.2-py2.py3-none-any.whl
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7febc7ffeb90>: Failed to establish a new connection: [Errno -2] Nom ou service inconnu')': /packages/5a/4a/39400ff9b36e719bdf8f31c99fe1fa7842a42fa77432e584f707a5080063/pip-20.2.2-py2.py3-none-any.whl
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7febc7ffeb10>: Failed to establish a new connection: [Errno -2] Nom ou service inconnu')': /packages/5a/4a/39400ff9b36e719bdf8f31c99fe1fa7842a42fa77432e584f707a5080063/pip-20.2.2-py2.py3-none-any.whl
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7febc7ffee10>: Failed to establish a new connection: [Errno -2] Nom ou service inconnu')': /packages/5a/4a/39400ff9b36e719bdf8f31c99fe1fa7842a42fa77432e584f707a5080063/pip-20.2.2-py2.py3-none-any.whl
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7febc7ffecd0>: Failed to establish a new connection: [Errno -2] Nom ou service inconnu')': /packages/5a/4a/39400ff9b36e719bdf8f31c99fe1fa7842a42fa77432e584f707a5080063/pip-20.2.2-py2.py3-none-any.whl
ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/5a/4a/39400ff9b36e719bdf8f31c99fe1fa7842a42fa77432e584f707a5080063/pip-20.2.2-py2.py3-none-any.whl (Caused by NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7febc8006990>: Failed to establish a new connection: [Errno -2] Nom ou service inconnu'))
WARNING: You are using pip version 20.1.1; however, version 20.2.2 is available.
You should consider upgrading via the '/home/ranto/.pyenv/versions/3.7.6/envs/vivadata/bin/python3.7 -m pip install --upgrade pip' command.
I finally solved my issue which was due to my poor connection...
thanks

Getting error while building docker image

My Docker file is
FROM python:3
ADD myapp.py /
RUN pip3 install tensorflow-gpu
RUN pip3 install numpy
RUN pip3 install pandas
CMD ["python3", "./myapp.py]
When I build the docker image using
docker build -t gaurav .
I get the following errors
Step 4/5 : RUN pip3 install tensorflow-gpu
---> Running in 8f938c75e2e0
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fae543d7cd0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/tensorflow-gpu/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fae543d79d0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/tensorflow-gpu/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fae543d7220>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/tensorflow-gpu/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fae543d7640>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/tensorflow-gpu/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fae543d7790>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/tensorflow-gpu/
ERROR: Could not find a version that satisfies the requirement tensorflow-gpu (from versions: none)
ERROR: No matching distribution found for tensorflow-gpu
The command '/bin/sh -c pip3 install tensorflow-gpu' returned a non-zero code: 1
Can you help me here, I want to install all these packages, but I can't get past these errors.
https://github.com/tensorflow/tensorflow/issues/33374 - tensorflow is not available for python3.8 so you have to use python image with version 3.7 or lower:
FROM python:3.7
As stated here Tensorflow - requirements.
Tensorflow is supported only Python 3.5–3.7

Categories

Resources