I have a project on a machine behind a firewall with PyCharm installed and I'm trying to get some structure into it. Therefore I am trying to create some kind of utility module that I want to edit/develop while restructuring the project. I would love for those utilities to be reachable globally on the machine (Windows) because someone created many PyCharm projects that have cross references and imports using
import sys
import os
sys.path.insert(1, os.path.expanduser("path2otherProjectDirectory"))
from otherProjectDirectory import foo
How can I create a package or a reference in 'site-packages' so that I can use my utilities globally on the machine (preferably manually without using pip)?
First I tried to create a package using setup.py and installing it via pip. I figured out that setup.py is somewhat deprecated (and that's a long story on its own) and I am not sure if creating a wheel works for an editable packages. Also pip is trying to build dependencies using sources on the internet. Thing is, the machine sits behind a firewall. I can install packages via PyCharm or pip using a proxy but I cannot reach anything using the same proxy with my own package:
pip install -e /path/to/utils/ --proxy 10.1.2.3:1234
It results in this Error message:
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [7 lines of output]
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 ....>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/
I also tried using:
pip install -e --no-index --find-links /path/to/utils/
pip install -e /path/to/utils/ --no-index
but the package is being 'ignored' or I get erros like above ending in this (part of the story I was mentioning before):
ERROR: Could not find version that satisfies the requirement setuptools>=40.8.0 (frim version: none)
ERROR: No matching distribution found for setuptools>=40.8.0
I always thought setuptools was included in the python installation. I had to install it myself (via pip or Pycharm) but that doesn't seem to help either (same issues occur). So now I'm abandoning pip. I mean you could simply put a package inside 'site-packages' and it will load just fine but wont be editable, right? What is pip doing when using '-e' / '--editable'? Is there a way to do that manually?
I also tried Installing package as editable with multiple packages with same top-level module breaks import.
I'm using Windows 10, Python 3.13 and setuptools 75.4.0.
I have a project on a machine behind a firewall with PyCharm installed and I'm trying to get some structure into it. Therefore I am trying to create some kind of utility module that I want to edit/develop while restructuring the project. I would love for those utilities to be reachable globally on the machine (Windows) because someone created many PyCharm projects that have cross references and imports using
import sys
import os
sys.path.insert(1, os.path.expanduser("path2otherProjectDirectory"))
from otherProjectDirectory import foo
How can I create a package or a reference in 'site-packages' so that I can use my utilities globally on the machine (preferably manually without using pip)?
First I tried to create a package using setup.py and installing it via pip. I figured out that setup.py is somewhat deprecated (and that's a long story on its own) and I am not sure if creating a wheel works for an editable packages. Also pip is trying to build dependencies using sources on the internet. Thing is, the machine sits behind a firewall. I can install packages via PyCharm or pip using a proxy but I cannot reach anything using the same proxy with my own package:
pip install -e /path/to/utils/ --proxy 10.1.2.3:1234
It results in this Error message:
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [7 lines of output]
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 ....>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/setuptools/
I also tried using:
pip install -e --no-index --find-links /path/to/utils/
pip install -e /path/to/utils/ --no-index
but the package is being 'ignored' or I get erros like above ending in this (part of the story I was mentioning before):
ERROR: Could not find version that satisfies the requirement setuptools>=40.8.0 (frim version: none)
ERROR: No matching distribution found for setuptools>=40.8.0
I always thought setuptools was included in the python installation. I had to install it myself (via pip or Pycharm) but that doesn't seem to help either (same issues occur). So now I'm abandoning pip. I mean you could simply put a package inside 'site-packages' and it will load just fine but wont be editable, right? What is pip doing when using '-e' / '--editable'? Is there a way to do that manually?
I also tried Installing package as editable with multiple packages with same top-level module breaks import.
I'm using Windows 10, Python 3.13 and setuptools 75.4.0.
Share Improve this question edited Nov 18, 2024 at 14:44 ibanezONE asked Nov 18, 2024 at 10:16 ibanezONEibanezONE 93 bronze badges 3 |1 Answer
Reset to default 1The error smells like your package requires setuptools
to to be built (likely because the package's build-system.requires
TOML key says so), and the pip subprocess that's responsible for that building doesn't get your --proxy
setting.
Try configuring the proxy with another method – I'd try with the http_proxy
/https_proxy
environment variables first.
You can then also use pip wheel -e .
to have Pip gather up all of the requirements for the package in the current directory, so you don't need an internet connection in the future for those dependencies.
pip
so it cannot use the appropriate proxy and that is creating lots of problems so you are trying to find a different way of doing things without usingpip
. Don't do that; fix the underlying issue withpip
so that you can connect via the proxy. We can't easily help with that (since you haven't told us what is different between yourpip
configuration and in PyCharm) but you may need to also provide authentication (maybe a client certificate) to the proxy. – MT0 Commented Nov 18, 2024 at 10:39pip
to connect via the proxy (if PyCharm works then you should be able to configure pip in the same way) then you can setup a local pip repository and manually copy all the dependencies to that and then install dependencies from the local pip repository. – MT0 Commented Nov 18, 2024 at 10:42pip install publicModule --proxy 10.1.2.3:1234
. I've added the full error message above. – ibanezONE Commented Nov 18, 2024 at 13:34