Skip to content
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

Issues with editable install (PEP660) #295

Closed
ghbrown opened this issue May 17, 2024 · 1 comment
Closed

Issues with editable install (PEP660) #295

ghbrown opened this issue May 17, 2024 · 1 comment

Comments

@ghbrown
Copy link
Contributor

ghbrown commented May 17, 2024

While trying to fork and edit pyttb, I faced errors manifesting as pyttb importing modules/classes/functions in a manner inconsistent with __init__.py.

Ultimately, I believe this is due to issues with pip and/or setuptools as they add support for PEP660 for editable installs of projects using pyproject.toml.

Consider the following code, which uses pyttb in accordance with the init file:

import numpy as np
import pyttb as ttb

X = np.random.uniform(size=(3,3,3))
X = ttb.tensor(X)

M1 = ttb.cp_als(X,3)

This code errors with X = ttb.tensor(X) AttributeError: module 'pyttb' has no attribute 'tensor' if installing pyttb via:

pip install -e ".[dev,doc]"

In particular, it seems that this happens because the pyttb/build/__editable__.pyytb<some more stuff> is not being included in PYTHONPATH, which may be an issue to report upstream to pip or setuptools.

(Workaround) The code runs successfully if installing via:

pip install -e ".[dev,doc]" --config-settings editable_mode=strict

Eventually, I believe a future version of pip and/or setuptools will make this issue irrelevant, but in the meantime here is the workaround.
It also seems plausible pyproject.toml could be edited to made more robust to these transitional issues.

System info:

  • pip 24.0 (python 3.9)
  • setuptools 69.5.1

Relevant links:

@ghbrown
Copy link
Contributor Author

ghbrown commented Jun 12, 2024

I know nothing changed on your side, but this seems resolved now. The sample code runs successfully after installing via the first (standard) approach.

Not sure if I had some sort of bug in my setup before, or if it has to do with now being on setuptools 70.0.0.

@ghbrown ghbrown closed this as completed Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant