matham/thorcam

ModuleNotFoundError: No module named 'ffpyplayer.pic'

pepbfer opened this issue · 9 comments

Hello, I would love to use your most recent version to interface my thorlabs camera using python, but whenever I do
from thorcam import camera
I am getting the following error:
Traceback (most recent call last):

File "<ipython-input-1-47587571612f>", line 1, in <module> from thorcam import camera

File "C:\Users\*\AppData\Local\Programs\Python\Python39\Lib\site-packages\thorcam\__init__.py", line 11, in <module> from ffpyplayer.pic import Image

ModuleNotFoundError: No module named 'ffpyplayer.pic'

I am using spyder, windows10, 64-bit. You suggest using as programming language the Python 3.7 but for some reason, I can only use 3.9.1. Can this be the problem (I am not being able to replace 3.9.1 for 3.7, that's why I would like to also know if this could be a problem)?

3.9 should be fine. But have you installed ffpyplayer? The error message says that ffpyplayer is not properly installed.

I did a pip install thorcam and it automatically installed ffpyplayer. Am I doing something wrong in the installation?

I'm not sure what is going wrong, but something is almost definitely wrong with your install because that error means ffpyplayer was not properly installed.

I would create a new virtualenv and install it there. That way you could try with a clean install. And a virtualenv is anyway always a good idea. It's just:

python -m pip install --upgrade pip setuptools virtualenv
python -m virtualenv venv
venv\Scripts\activate

python -m pip install thorcam
...

I still have the same issue. I uninstalled python 3.9 and installed 3.8 due to the recommendations in #7 related with pythonnet and still got the same message.
Whenever I do from thorcam import camera i get

File "<ipython-input-14-9cae979d703d>", line 1, in <module>
   from thorcam.camera import ThorCam

 File "C:\Users\*\AppData\Local\Programs\Python\Python38\Lib\site-packages\thorcam\camera.py", line 32, in <module>
   from ffpyplayer.pic import Image

ModuleNotFoundError: No module named 'ffpyplayer.pic'

From the error I can see that you're still not using a virtualenv. Please try the virtualenv as I suggested as that would eliminate some error possibilities. Only install thorcam in it and try importing it from the default interpreter (i.e. don't install ipython). It's very possible and likely that another package you installed is conflicting. A virtualenv with just thorcam and ffpyplayer would eliminate that possibility. If that still doesn't work, the next step is to clear your PATH env variable because something in it likely has a conflicting dll or something.

So please try with a virtualenv. Also, please list your exact OS (Windows 10?) as well as where you got python from, and whether you have anaconda installed.

I added a test which tries to list the available cameras (5518fb3) and the tests pass on the CI. This tells me that the issue is specific to your computer, which means some kind of install issue.

I've significantly expanded the install instructions with exact instructions, including for anaconda, as well as a troubleshooting section that should hopefully help resolve the issue. But it's mostly what I've already mentioned here about a virtualenv (except for conda that is new and tested).

Please read https://matham.github.io/thorcam/installation.html and follow it carefully to see if it fixes your issue.

Thank you very much, well I am doing it now. But I get the message

EDT pdv open failed.
Check board installation and unit number, and try restarting the computer

but even though you say " just ignore it as it doesn’t seem to affect the camera functioning and it’s unclear the source of this." my camera is not being detected but it is detected by the Thorlabs software

What is your camera model? Because if it's not detected and you're not getting a python error maybe the thor sdk is not compatible with your camera? I get the same EDT pdv open failed. message for our camera but it works fine, so I don't think that's the issue. Since you're not getting a python error it means the library works as expected, but just doesn't find your camera.

And to be sure, what code are you running to list the cameras?

Specifically, it's not compatible with the DCx cameras, only the scientific cameras (#7).

Thank you very much, that must be the issue