It seems that you have the lmfit
module installed for python 3.8
and you are running python 3.7
on Spyder for which the module is not installed.
Preferrable method for you is option 3 as you said you want to fix it for Spyder. The blockquote explains the detailed procedure to do that.
- A possible fix is to change the symbolic link and fix it to
python 3.8
. You can check how to change the path here (Follow the instructions and replace 3.6 with 3.7 and 3.7 with 3.8 for your case)
- Use a virtual environment to juggle between multiple versions.
- Change the version which spyder uses for python. To do this:
Open Preferences in Spyder => Tools - Preferences
Click on Python Interpreter
from the options in left
Now the Selected option, right below Select the Interpreter for all Python Consoles
should be Default (i.e. use the same as Sypder's)
,
Now change it to Use the following interpreter:
and it will ask for
a path below it.
Provide the path to your Python 3.8 installation folder.
You can find the path using:
whereis python3.8
in your ubuntu command line interface (Note for windows where python3.8
should work fine).
In general the path should be something like \usr\bin\python3.8
but it depends on
how you have installed it. Take the path to python3.8
and paste it
in that path. You can also browse for python3.8
in that path and
select it manually from the spyder interface.
Now Apply
it and Ok
it. Restart Spyder
and you should be
running python3.8 and now you can import lmfit
in there.
A visual representation of this process (except on how to find the path) could be found here
import sys
sys.version
– Zenquiorra Jun 15 '20 at 09:01sys.path
sys.executable
It could be possible that python is executed in some environment and the module is installed in a different environment. – Zenquiorra Jun 15 '20 at 09:04sys.version
gives3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)]
sys.path
gives a bunch of path names, and I don't know what I should be looking for.sys.executable
gives a file calledpythonw.exe
in my folderAnaconda3
. – ellie_arroway Jun 15 '20 at 18:34Can you please paste the output of
– Zenquiorra Jun 16 '20 at 07:57python --version
andpython3 --version
. Also, how are you running python on your system? Are you usingpython
command orpython3
from the CLI? If you are usingpython
, then can you please try runningpython3
and importing the module there?python --version
is~$ python version Command 'python' not found, did you mean: command 'python3' from deb python3 command 'python' from deb python-is-python3
The output ofpython3 --version
isPython 3.8.2
– ellie_arroway Jun 16 '20 at 17:22pip3 install lmfit
. But I still want to make it work in Spyder for future use. – ellie_arroway Jun 16 '20 at 17:25