I am a beginner and I am looking to install PYGMT on windows 10. I first installed anaconda for windows10 (C:\Users\burlotr). Then I launched the Anaconda Powershell Prompt to start the installation of PYGMT.
I followed the installation guide on the site but I’m stuck at the 3rd step of the QuickStart.
Hi @Remy, thanks for trying out PyGMT! To help you with your problem, can you provide the output from the following commands (run it step by step in Anaconda prompt):
conda activate pygmt
conda list
jupyter kernelspec list --json
python -c "import pygmt; pygmt.show_versions()"
Just want to make sure that things are installed properly, sometimes the paths can get a bit messed up which results in the ModuleNotFoundError.
Right, so from your jupyter kernelspec list --json output, it appears that your ‘pygmt’ kernel was not installed correctly, it is using the system python (C:\Users\burlotr\Anaconda3\python.exe) instead of the ‘pygmt’ virtual environment’s python. What you will need to do is re-run these commands:
Note that the conda activate pygmt step is the critical part here, you want to make sure that you are inside the ‘pygmt’ virtual environment before doing the ipykernel install. If all goes well, the output from jupyter kernelspec list --json should say the ‘pygmt’ environment uses Python from C:\Users\burlotr\Anaconda3\envs\pygmt\bin\python.exe (or something like that).
Ah yes, you’ll have to do conda install ipykernel first, or if you’re using jupyter, you might as well do conda install jupyterlab (which will pull in ipykernel too).
Note that you’ll have to run these after conda activate pygmt (i.e. make sure there is (pygmt) on the left which indicates you are in the ‘pygmt’ virtual environment.
Yes, the changes have been taken into account !
But the same error, from my first message, appeared on jupyter notebook.
And yes, I am careful to run the command “conda activate pygmt”. it is indicated just to the left of my requests -->(pygmt)
If you get a ‘jupyter’ not found error, try doing conda install jupyterlab first. Oh, and make sure you have the ‘pygmt’ kernel selected on the top right corner. Sorry for all the extra steps, just that Python virtual environments can be tricky sometimes…
(pygmt) C:\Users\burlotr>conda install jupyterlab
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
ResolvePackageNotFound:
python=3.1
I tried to reinstall jupyter lab, but it doesn’t work in the pygmt environment.
Oo ok, that python=3.1 error is because you have Python 3.10 installed (there’s a silly conda bug where 3.10 gets converted to 3.1), could you do conda install python=3.9 jupyterlab instead?
Huh, that’s strange. If you did import pygmt and pygmt.show_versions(), then things should be working. Could you restart the jupyter kernel and retry? Maybe do a help(pygmt) and see if you get any output.