r/pythonhelp • • Apr 19 '22

Python package problems

I guys, i try to run some script from github on my PC on w11 ( i know linux is better) and i think i do the right installation with the right packages but i still have an error to built 'setup.py' if you have any idea it will be greatfull.

here is a copy of the error : Can not execute 'setup.py' since setuptools is not available in the built environnement.

I try pip install -U setuptools , and pip install openupgradelib but the same error apears. Thanks for the help

version : Python 3.10.4

2 Upvotes

9 comments sorted by

1

u/Goobyalus Apr 19 '22

Can you show exactly how you are invoking python and pip, and check their versions?

pip --version

replacing pip with your exact invocation of pip, and

python --version

replacing python with your exact invocation of python whether it's python3 or whatever?

Maybe python3 -m pip install setuptools will work for you (replacing python3 with whichever invocation of python you expect to be using).

1

u/alexenderthegrand Apr 20 '22

python version is : 3.10.4

pip version is : pip3.10

I use py - m pip install setuptools

1

u/Goobyalus Apr 20 '22

That's not a pip version, but ok. I was trying to make sure you're not installing setuptools for a different environment than the particular python you're using.

Does your py -m pip install setuptools succeed in the same environment that you're trying to run your program?

1

u/alexenderthegrand Apr 20 '22

yes it's work pretty well

1

u/Goobyalus Apr 20 '22

So setuptools installs successfully, but you still get an error when trying to isntall your requirements.txt?

Did it work after removing pathlib as social_nerdtastic suggested?

0

u/socal_nerdtastic Apr 19 '22

i know linux is better

No it's not. It's different, and some people like it better (including me), but it's not definitively better in any way. It's just a matter of what you like.

Unless of course the script you are trying to install is specifically written for Linux. Which is what it sounds like in this case.

What package exactly are you trying to install? What command exactly are you using?

1

u/alexenderthegrand Apr 20 '22

Yes you right i prefer linux but neef w11 to work and don't have ressources yet to run a proprer virtual machine.

I dont think it's specifically for linux .

I want to install fews package i need to run the script i want to :

I use : py -m pip install -r requirements.txt

where requirements.txt it's the list of packages

Everything run well until i reach the package pathlib here is a copy of my shell :

"Collecting pathlib

Using cached pathlib-1.0.1.tar.gz (49 kB)

Preparing metadata (setup.py) ... error

error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.

│ exit code: 1

╰─> [1 lines of output]

ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.

[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

error: metadata-generation-failed

× Encountered error while generating package metadata.

╰─> See above for output."

thanks for your help appreciate.

1

u/socal_nerdtastic Apr 20 '22 edited Apr 20 '22

That must be a very old module you are trying to install, pathlib has been included in python for many years now. Just remove that line from requirements.txt.

The error is because pip is trying to install the backport package https://pypi.org/project/pathlib/
but in reality you want your program to use the built-in module https://docs.python.org/3/library/pathlib.html

1

u/alexenderthegrand Apr 20 '22

okay thanks for your help i will forget this error and try ti run my scripts