Skip to content

Editable installs do not work correctly on Py3.12/3.13

Python 3.12 on windows:

haxquantpy looks for data in site-packages.

(py312) PS D:\Patrick\Documents\Projects\polariseval> python -m pip install -e .\haxquantpy\
Obtaining file:///D:/Patrick/Documents/Projects/polariseval/haxquantpy
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Installing backend dependencies ... done
  Preparing editable metadata (pyproject.toml) ... done
Requirement already satisfied: h5py in d:\miniforge3\envs\py312\lib\site-packages (from haxquantpy==0.0.2) (3.11.0)
Requirement already satisfied: matplotlib in d:\miniforge3\envs\py312\lib\site-packages (from haxquantpy==0.0.2) (3.9.1)
Requirement already satisfied: numpy in d:\miniforge3\envs\py312\lib\site-packages (from haxquantpy==0.0.2) (2.0.1)
Requirement already satisfied: scipy in d:\miniforge3\envs\py312\lib\site-packages (from haxquantpy==0.0.2) (1.14.0)
Requirement already satisfied: contourpy>=1.0.1 in d:\miniforge3\envs\py312\lib\site-packages (from matplotlib->haxquantpy==0.0.2) (1.2.1)
Requirement already satisfied: cycler>=0.10 in d:\miniforge3\envs\py312\lib\site-packages (from matplotlib->haxquantpy==0.0.2) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in d:\miniforge3\envs\py312\lib\site-packages (from matplotlib->haxquantpy==0.0.2) (4.53.1)
Requirement already satisfied: kiwisolver>=1.3.1 in d:\miniforge3\envs\py312\lib\site-packages (from matplotlib->haxquantpy==0.0.2) (1.4.5)
Requirement already satisfied: packaging>=20.0 in d:\miniforge3\envs\py312\lib\site-packages (from matplotlib->haxquantpy==0.0.2) (24.1)
Requirement already satisfied: pillow>=8 in d:\miniforge3\envs\py312\lib\site-packages (from matplotlib->haxquantpy==0.0.2) (10.4.0)
Requirement already satisfied: pyparsing>=2.3.1 in d:\miniforge3\envs\py312\lib\site-packages (from matplotlib->haxquantpy==0.0.2) (3.1.2)
Requirement already satisfied: python-dateutil>=2.7 in d:\miniforge3\envs\py312\lib\site-packages (from matplotlib->haxquantpy==0.0.2) (2.9.0)
Requirement already satisfied: six>=1.5 in d:\miniforge3\envs\py312\lib\site-packages (from python-dateutil>=2.7->matplotlib->haxquantpy==0.0.2) (1.16.0)
Building wheels for collected packages: haxquantpy
  Building editable for haxquantpy (pyproject.toml) ... done
  Created wheel for haxquantpy: filename=haxquantpy-0.0.2-py3-none-any.whl size=2869 sha256=95db2a4500cb0b53484c68e030aa07e1a9b7460fb6d3a43ad00ba724fbbb2433
  Stored in directory: C:\Users\Patrick\AppData\Local\Temp\pip-ephem-wheel-cache-bmydo8vk\wheels\63\99\69\ec107ece2057342996395c6ea45ea9e0f620e55cb02a2c30dc
Successfully built haxquantpy
Installing collected packages: haxquantpy
  Attempting uninstall: haxquantpy
    Found existing installation: haxquantpy 0.0.2
    Uninstalling haxquantpy-0.0.2:
      Successfully uninstalled haxquantpy-0.0.2
Successfully installed haxquantpy-0.0.2
(py312) PS D:\Patrick\Documents\Projects\polariseval> cd ..
(py312) PS D:\Patrick\Documents\Projects> python
Python 3.12.5 | packaged by conda-forge | (main, Aug  8 2024, 18:24:51) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import haxquantpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\miniforge3\envs\py312\Lib\site-packages\haxquantpy\__init__.py", line 1, in <module>
    from .photoionization import PhotoionizationParameterCoreLevel as PIC
  File "D:\miniforge3\envs\py312\Lib\site-packages\haxquantpy\photoionization.py", line 20, in <module>
    with open(atoms_filename, ) as atoms:
         ^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\miniforge3\\envs\\py312\\Lib\\site-packages\\haxquantpy\\files\\atoms.dat'

Similarly doing this with specqp you get a deprecation warning DEPRECATION: Legacy editable install of specqp==1.2.0 from file:///D:/Patrick/Documents/Projects/polariseval/specqp (setup.py develop) is deprecated. pip 25.0 will enforce this behaviour change. A possible replacement is to add a pyproject.toml or enable --use-pep517, and use setuptools >= 64. If the resulting installation is not behaving as expected, try using --config-settings editable_mode=compat. Please consult the setuptools documentation for more information. Discussion can be found at https://github.com/pypa/pip/issues/11457

So importing specqp works

(py312) PS D:\Patrick\Documents\Projects> python  
Python 3.12.5 | packaged by conda-forge | (main, Aug  8 2024, 18:24:51) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import specqp

But even though the paths are set correctly on sys.path

>>> import sys
>>> sys.path
['', 'C:\\BornAgain-21.1\\python', 'D:\\miniforge3\\envs\\py312\\python312.zip', 'D:\\miniforge3\\envs\\py312\\DLLs', 'D:\\miniforge3\\envs\\py312\\Lib', 'D:\\miniforge3\\envs\\py312', 'D:\\miniforge3\\envs\\py312\\Lib\\site-packages', 'D:\\Patrick\\Documents\\Projects\\polariseval\\haxquantpy', 'd:\\patrick\\documents\\projects\\polariseval', 'd:\\patrick\\documents\\projects\\polariseval\\specqp', 'D:\\miniforge3\\envs\\py312\\Lib\\site-packages\\win32', 'D:\\miniforge3\\envs\\py312\\Lib\\site-packages\\win32\\lib', 'D:\\miniforge3\\envs\\py312\\Lib\\site-packages\\Pythonwin']

The import of haxquantpy still looks at the wrong location...

>>> import haxquantpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\miniforge3\envs\py312\Lib\site-packages\haxquantpy\__init__.py", line 1, in <module>
    from .photoionization import PhotoionizationParameterCoreLevel as PIC
  File "D:\miniforge3\envs\py312\Lib\site-packages\haxquantpy\photoionization.py", line 20, in <module>
    with open(atoms_filename, ) as atoms:
         ^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\miniforge3\\envs\\py312\\Lib\\site-packages\\haxquantpy\\files\\atoms.dat'

Might in this special case be related to how the package determines where its data is located.

I did test py3.11 - no real issues that i found there.

Python 3.13

Specqp does not get the deprecation warning anymore But, the local paths for haxquantpy and poleval are not being set!!

>>> import sys
>>> sys.path
['', 'C:\\BornAgain-21.1\\python', 'D:\\miniforge3\\envs\\py313\\python313.zip', 'D:\\miniforge3\\envs\\py313\\DLLs', 'D:\\miniforge3\\envs\\py313\\Lib', 'D:\\miniforge3\\envs\\py313', 'D:\\miniforge3\\envs\\py313\\Lib\\site-packages', 'D:\\Patrick\\Documents\\Projects\\polariseval\\haxquantpy', 'D:\\miniforge3\\envs\\py313\\Lib\\site-packages\\win32', 'D:\\miniforge3\\envs\\py313\\Lib\\site-packages\\win32\\lib', 'D:\\miniforge3\\envs\\py313\\Lib\\site-packages\\Pythonwin']

Rerunning python -m pip install -e .\polariseval\haxquantpy\ .\polariseval\

Changes nothing. Scanning the output for clues? Nope... building wheels, no warnings or other messages....

What the heck?

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information