0
votes

I have python 3.7 and anaconda3 installed in Win10, and conda 4.7.12, conda is on my PATH. Had installed jupyter using pip (pip 19.3.1). I can see all packages in the the anaconda directory. Don't have any old python2 or anaconda2 nor any virtual env.

I have jupyter notebook - but for just about every package jupyter is complaining - ModuleNotFoundError. I did pip install for pandas, numpy etc in jupyter - it worked. But juypter complains about the next package, on and on. Do I have to do a pip install inside jupyter for every package or there is better/easier way.

(I know its never easy)

1
try to acticvate your conda env, then run "jupyter notebook" in the same cmd.exe window. I dont know how much experience you have with this so I am asking simple. why not use the GUI for Annaconda since you are using windows?:) - Stian Diehard
@Stian Diehard - I am new to all this. I do start jupyter by running jupyter notebook from command line. How do I activate conda env. I tried running jupyter with GUI for Annaconda. The problem went away - so if that is the easy way around this - I am fine with that. - Sam-T
jupyter comes with the version you have, you should actually never mix pip with conda as you see the outcome. you can install about any package with conda install packagename. conda will also automatically update all your packages (and install others at same time. the reason it worked using the navigator is because it activates anaconda base and all its packages. Using the navigation is the way to go! you can install, update and search for packages also. Anyways if I were you I would create a new envirement and activate with simply activate name. conda create --name myenv makes a new. - Stian Diehard
So I just create a new conda env (with any name) conda create --name myenv (no need to specify any packages). And activate it with conda activate myenv and then run jupyter notebook from same cmd shell ? But nonetheless you are suggesting just use the navigator. - Sam-T
I tried this it worked: conda create --name juypterenv conda activate jupyterenv jupyter notebook - Sam-T

1 Answers

0
votes

You should first check if you are using the same virtual for both running the notebook and installing packages. If so, then yes, if the modules are not installed you'd have to do it manually or create a requirements.txt file with all the modules you need and execute the following (within the same virtual environment):
pip install -r requirements.txt
See https://pip.pypa.io/en/stable/user_guide/#requirements-files for more information.

I'd also recommend installing the notebook extensions as per https://docs.anaconda.com/anaconda/user-guide/tasks/use-jupyter-notebook-extensions/ to deal with your virtual environments and packages.