modAL-python / modAL

A modular active learning framework for Python
https://modAL-python.github.io/
MIT License
2.24k stars 324 forks source link

No module named 'modAL.models'; 'modAL' is not a package #31

Closed notebooklinda closed 5 years ago

notebooklinda commented 5 years ago

After installing modAL by pip install modAL on Ubuntu 16.04 with a virtualenv python3.5, I tried to import modAL, but got the error message as titled. How can I solve this issue?

cosmic-cortex commented 5 years ago

What did you import specifically? Can you post the exact log with the import and the error message as well? Also, can you execute the

from modAL.models import ActiveLearner

command in a Python console?

I suspect this is a problem with the setup script. I have encountered this issue a long ago, but this was solved since then and I was unable to reproduce it, so I have no idea what went wrong.

Did you install the latest version, which is 0.3.4? (You can check it with pip freeze | grep modAL.)

notebooklinda commented 5 years ago

Thanks for your reply! The modAL version is the latest version. I eventually solved it by placing the modAL folder in the same path as the python script that imports modAL. I think it this case the path matters.

cosmic-cortex commented 5 years ago

I am afraid if the script won't run when not in the same folder with modAL, the problem is not solved yet :( Unfortunately, I was unable to reproduce this error on a freshly installed machine, so I still don't know what might went wrong.

In your script, which one did you try?

import modAL

or

from modAL.models import ActiveLearner
notebooklinda commented 5 years ago

Both, and they gave me the same error message. I used a virtualenv, and after running pip install modAL in my virtualenv, I could find modAL was installed and located in site-packages my working directory is (activelr) notebooklinda@notebooklinda:~/Documents/02-750_automation_of_biological_research/TA$ modAL is located at (activelr) notebooklinda@notebooklinda:~/Documents/02-750_automation_of_biological_research/TA$ locate -b modAL /home/notebooklinda/Documents/02-750_automation_of_biological_research/TA/activelr/lib/python3.5/site-packages/modAL /home/notebooklinda/Documents/02-750_automation_of_biological_research/TA/activelr/lib/python3.5/site-packages/modAL-0.3.4.dist-info

After I copy the entire modAL directory to my working directory, I am able to import modAL.

kevinkit commented 2 years ago

I had the same issue when using Spyder and closing the Console / Restaring the Kernel. Restaring Spyder seems to fix this issue.

An easy check is to start the command tool in your virtual environment and check if you are able to import modAL there.

mgfcatherall commented 1 year ago

I had the same/similar issue and fixed it by renaming the install folder from modAL to modal, maybe everyone stick to lowercase for package names in future?

cosmic-cortex commented 1 year ago

I had the same/similar issue and fixed it by renaming the install folder from modAL to modal, maybe everyone stick to lowercase for package names in future?

There was a change in PyPI, modAL has been moved under the name modAL-python. The package modal is a different one! (See #170.)

evaZQR commented 1 year ago

I had the same/similar issue and fixed it by renaming the install folder from modAL to modal, maybe everyone stick to lowercase for package names in future?

There was a change in PyPI, modAL has been moved under the name modAL-python. The package modal is a different one! (See #170.)

I had the same problem,but I can't find the 'modAL.model',but i can find "modal",not 'modAL',it seems like that they are not the same package?

scao0208 commented 1 year ago

I am afraid if the script won't run when not in the same folder with modAL, the problem is not solved yet :( Unfortunately, I was unable to reproduce this error on a freshly installed machine, so I still don't know what might went wrong.

In your script, which one did you try?

import modAL

or

from modAL.models import ActiveLearner

Hey I think it may be "pip install modAL-python"

swayson commented 9 months ago

Wow, so the docs is wrong? it is not pip install modAL but "pip install modAL-python". The latter resolved the issue for me.

breakthewall commented 7 months ago

This happens also when the filename from where you do the import is modAL.py. A simple renaming fixes the issue.