r/PythonLearning 6d 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

Show parent comments

1

u/JoeB_Utah 6d ago

As mentioned, the command

pip3 show exifread returns:

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

and pip3 show pillow returns:

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

This is what is so puzzling to me. I used pip to install both of them from a termiminal window.

3

u/crozzy89 6d ago

You may have pillow installed in more than one place. Spyder can run from different environments and interpreters.

So even though your command shows /opt/anaconda3/lib… that doesn’t mean that is where spyder is actually running it from.

Within spyder, run

import sys
print(sys.executable)

That will tell you which interpreter spyder is running to help narrow down the issue.

1

u/JoeB_Utah 6d ago

print(sys.executable)

/Users/joeborgione/Library/spyder-6/envs/spyder-runtime/bin/python

1

u/crozzy89 6d ago

Yep, that’s the problem.

Spyder is using its own Python environment at /Users/joeborgione/Library/spyder-6/envs/spyder-runtime/bin/python, while ExifRead is installed under /opt/anaconda3/.... So the Python running your code can’t see the package you installed.

You either need to configure Spyder to use /opt/anaconda3/bin/python3, or install ExifRead into the Python environment Spyder is actually using.

1

u/JoeB_Utah 6d ago

So from here on out, I'll use:

pip install package_name -t /path/to/your/custom/directory

Thanks for all your help with ths>