1

I have a problem. I use anaconda and make an environment. I check python in my terminal and everything is ok.

(anaconda_env) jakub@jakub-Z370-HD3P:/media/jakub/WD/EnerPres_g2020_2/bez_zmian/POPC_300K_11_01_2021_bez_zmian_parametrow/calc_order$ python
Python 3.9.1 (default, Dec 11 2020, 14:32:07) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
>>> import numpy as np
>>> import MDAnalysis as mda
>>> 

But when I run Jupyter notebook by write in terminal

(anaconda_env) jakub@jakub-Z370-HD3P:/media/jakub/WD/EnerPres_g2020_2/bez_zmian/POPC_300K_11_01_2021_bez_zmian_parametrow/calc_order$ jupyter-notebook

I have problems

from platform import python_version

print(python_version())
3.7.1
import pandas as pd
import numpy as np
import MDAnalysis as mda
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-7-c040e9ed8c6a> in <module>
      1 import pandas as pd
      2 import numpy as np
----> 3 import MDAnalysis as mda

ModuleNotFoundError: No module named 'MDAnalysis'

Why I can't import modules and why the Jupyter Python version is different?

Edit: I found the solution, I just installed on that environment jupyter again:

(anaconda_env) jakub@jakub-Z370-HD3P:/media/jakub/WD/EnerPres_g2020_2/bez_zmian/POPC_300K_11_01_2021_bez_zmian_parametrow/calc_order$ pip install jupyter
1
  • 1
    I suggest that you don't list paths inside your machine. Just write the important info. e.g.: (anaconda_env) me@hd:/mypath$ pip install jupyter Commented Dec 12, 2021 at 18:03

2 Answers 2

1

This is likely/often that the jupyter installation isn't in the same conda environment as the modules you want to import. Try "conda install jupyter" from the environment which has the modules you want to import inside jupyter.

Sign up to request clarification or add additional context in comments.

Comments

0

In my case,

conda update -n base -c defaults conda

conda activate <Your Environment Name>

conda install jupyter (included ipykernel)

IN jupyter notebook, ipython,

import sys

sys.version

You can check your same version with your shell's python version.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.