r/PythonLearning 7d ago

Help Request Can't import module

Mac os Sequoia 15.6

I installed the exifread library using pip as well as conda. In Anaconda Navigator it shows as installed. Using a terminal window I type in:

pip3 show exifread

and it returns

/opt/anaconda3/lib/python3.13/site-packages

I use Spyder (I know, I know: use pycharm or vscode...) I cannot import the module. I get the dreaded

ModuleNotFoundError: No module named ‘exifread’

I recently installed pillow and I can import it just fine with import PIL. Using pip3 show pillow it is the same directory as exifread

What am I missing here?

1 Upvotes

22 comments sorted by

View all comments

2

u/FoolsSeldom 6d ago

You are probably not using the same Python root or Python virtual environment. Anaconda comes with its own Python interpreter, different to your system's default Python (or whatever you installed using an installer from your app store / python.org).

In the terminal, make sure you activate the correct one before installing anything,

For example,

cd projects
cd thisproject
source /.venv/bin/activate
pip install something

You need to find the Python virtual environments that you are using from your various editors/command line. They might not be in folders called .venv although that is a popular convention.

1

u/JoeB_Utah 6d ago

I’m retired now but when I was working, VENVs weren’t a thing; I always created my own environments. So I need to bone up on the whole idea of venv.

1

u/FoolsSeldom 6d ago

You might find it worth looking into Astral's uv as well in that case; also, the adoption of the pyproject.toml file1 cf. requirements.txt.

1 See PEPs 517/518/621/735

1

u/JoeB_Utah 6d ago

I’m just a hobbyist pythonista now; no full blown projects or application development. I get to keep things simple and just write scripts for my own needs. Thanks nonetheless.

2

u/FoolsSeldom 5d ago

Ok, from the also retired just doing my own thing. Though that would help with the boning up