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

ModuleNotFoundError: No module named 'toqito' #386

Closed
Bchass opened this issue Dec 21, 2023 · 5 comments
Closed

ModuleNotFoundError: No module named 'toqito' #386

Bchass opened this issue Dec 21, 2023 · 5 comments

Comments

@Bchass
Copy link
Contributor

Bchass commented Dec 21, 2023

Installed toqito via pip and tried to run pytest in the root dir and in specific folder:

ImportError while importing test module '/Users/bchass/Documents/Forks/toqito/toqito/rand/tests/test_random_ginibre.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: /Users/bchass/.pyenv/versions/3.10.0/lib/python3.10/importlib/__init__.py:126: in import_module return _bootstrap._gcd_import(name[level:], package, level) ../__init__.py:2: in <module> from toqito.rand.random_unitary import random_unitary E ModuleNotFoundError: No module named 'toqito'

I've reinstalled the package and tried to install with setup.py instead which yields the same results.

Pip list for the virtual env:

Screenshot 2023-12-21 at 7 59 33 AM

I'm not sure what I'm missing, but all tests throw an error.

@vprusso
Copy link
Owner

vprusso commented Dec 21, 2023

The version of toqito on the PyPi server is going to be different than the one pulled down via GitHub. Specifically, the toqito.random path is now toqito.rand

You'll want to install toqito within the root of the project as:

pip install -e .

Then you should be able to:

from toqito.rand import random_unitary

@Bchass
Copy link
Contributor Author

Bchass commented Dec 21, 2023

The version of toqito on the PyPi server is going to be different than the one pulled down via GitHub. Specifically, the toqito.random path is now toqito.rand

You'll want to install toqito within the root of the project as:

pip install -e .

Then you should be able to:

from toqito.rand import random_unitary

I see. I did a fresh install with pip install -e . and I'm still getting the same results. But if I do from toqito.rand import random_unitary in a python shell, it works just fine. This leads me to believe the virtual env is the culprit.

@Bchass
Copy link
Contributor Author

Bchass commented Dec 21, 2023

Some interesting discoveries - during the process of pip install -e ., cvx was never installed. Due to this, it also indicated pytest, pytest-cov, and scikit-image were not installed either automatically. Once I manually installed these packages, I was then able to install cvx manually and pytest is now working correctly.

@purva-thakre
Copy link
Collaborator

purva-thakre commented Dec 21, 2023

during the process of pip install -e ., cvx was never installed.

@Bchass Yes, we are aware of this. #207 (comment)

Using poetry for installing toqito won't cause problems like this.

@purva-thakre
Copy link
Collaborator

Closing this as the issue appears to be resolved partially. The unresolved portion has an open issue.

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

3 participants