-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[BUG] pip install -e .
on Windows creates broken .pth files
#3937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @simaoafonso-pwt, could you please post here what would be the contents of the |
It's a single line the correct path (
I think paths on Windows are a special case, they are not UTF-8. |
Does anything get added to |
It's not added to As UTF-8: > python
Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', 'C:\\Program Files\\Python38\\python38.zip', 'C:\\Program Files\\Python38\\DLLs', 'C:\\Program Files\\Python38\\lib', 'C:\\Program Files\\Python38', '%CD%', '%CD%\\lib\\site-packages']
>>> import tkmilan
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tkmilan'
>>> sys.path.append(r"%HOME%\tkmilan\src")
>>> import tkmilan
>>> As ANSI: >python
Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', 'C:\\Program Files\\Python38\\python38.zip', 'C:\\Program Files\\Python38\\DLLs', 'C:\\Program Files\\Python38\\lib', 'C:\\Program Files\\Python38', '%CD%', '%CD%\\lib\\site-packages', '%HOME%\\tkmilan\\src'] |
@simaoafonso-pwt, I am trying to create a reproducer with a windows container to ask the Python maintainers for advice about this matter. When I try to change the encoding to ASCII I am no longer able to use the In my machine I have Could you please tell me what are the values in your system? |
Not sure if this answers your question, I'm not familiar with all these PowerShell commands.
|
Thank you very much Simão. I did not manage to reproduce this with a Windows container (for some reason they seem to always be UTF-8, and I did not find out how to change that), however I managed to run this in a Windows machine I have access to, with the following steps:
|
@jaraco do you have any advice here? In the setuptools/setuptools/command/editable_wheel.py Lines 404 to 405 in 1aed0ff
We could change the
|
Hi @simaoafonso-pwt. I run the following as a manual test (PowerShell): cd $env:TEMP
git clone https://github.com/pypa/sampleproject tkmilan_ç_utf8
cd tkmilan_ç_utf8
python3 -m venv .venv
.venv\Scripts\python -m pip install -U 'pip==23.2'
.venv\Scripts\python -m pip install -U wheel https://github.com/abravalheri/setuptools/archive/refs/heads/issue-3937.zip
.venv\Scripts\python -m pip install -e . --no-build-isolation Then I tried to open I also tried to run the following (with no error): .venv\Scripts\python -c 'import sample; print(sample)'
<module 'sample' from '...TEMP..\\tkmilan_ç_utf8\\src\\sample\\__init__.py'> However that might not be a good indication if things are working or not, because I never managed to reproduce the error localy. Can you have a look to see if the PR solves the problem in your system (see in the steps above how I install the version of setuptools provided by the PR and how I disable the build isolation to ensure that is the version of setuptools that is used during the build.). |
Hi @abravalheri
Can confirm the problem is fixed with that Thanks for taking care of that. |
setuptools version
67.8.0
Python version
3.8.10
OS
Windows 10
Additional environment information
Tried with newer Python versions, same problem.
Description
I tried to install my PEP571 package in editable mode and it works, but since my installation path is not ASCII, the .pth file is created as UTF-8 and Python just ignores it.
Expected behavior
Using
pip install -e
should create non-UTF-8 .pth files.How to Reproduce
Start with an empty folder
Setup the venv and the project:
Edit
venv\Lib\site-packages\__editable__.tkmilan-0.31.dev5+g89be321.pth
on Notepad and save as ANSI format.Try and run the showcase, notice it works:
Output
See above
The text was updated successfully, but these errors were encountered: