No module named 'lmfit'

Hello,
I have a .py script that works perfectly in Jupyter Notebook.
However, when I run it with Psychopy at the line “from lmfit import Model” gives me the error “ModuleNotFoundError: No module named ‘lmfit’”

Do I need to install lmfit in Psychopy as well? How can I do that?

Thanks

Mauro

Are you using a standalone download of PsychoPy? If so, the Python being used by PsychoPy may be different from the one you’re calling when you use Jupyter Notebook. You need to download the lmfit package on the Python called by PsychoPy specifically.

Here are some handy instructions: https://www.psychopy.org/recipes/addCustomModules.html

First, I copied and pasted the lmfit package in the package contents of Psychopy
(Contents/Resources/lib/python3.6/lmfit-1.0.0)
I then went to Preferences-General and added the path:
[’/Users/myname/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/lmfit-1.0.0’, ]

I also added “import psychopy” at the beginning of my script, but same error.

What am I doing wrong?