Hello,
I just installed obspy 1.1.0 with conda 4.5.11 on xUbuntu 18.04 LTS, following the instruction (https://github.com/obspy/obspy/wiki/Installation-via-Anaconda). I installed obspy and basemap in a separate environment, as described in the instruction.
When running my code in a jupyter notebook, I get the error message : "ModuleNotFoundError: No module named 'obspy'" when trying to import obspy. I have the same message with ipython.
When checking with "conda list", I can see that obspy is installed.
obspy 1.1.0 py36_1 conda-forge
python 3.6.6 h5001a0f_0 conda-forge
matplotlib 2.2.3 py36h8e2386c_0 conda-forge
I didn't put the whole list because of the length (81 items).
The only similar issue I found was with obspy 1.0.3 (https://github.com/obspy/obspy/issues/1884), due to a matplotlib 2 compatibility problem. But I think that it was fixed with 1.1.0.
I ran the tests and got this result (report sent to tests.obspy.org):
Ran 1705 tests in 181.611s
FAILED (failures=33, errors=8)
Regards
Richard
Make sure you are using the correct Python kernel in the jupyter notebook. It is quite easy to use a different Python environment in the notebooks. Or the actual jupyter notebook might be installed in a different environment. sys.executable should give you path of the Python binary used.
The errors you see in the tests are all fixed in the master (I think) and largely related to the fact that numpy changed the way it formats arrays a short while ago.
note also, if you followed the instructions are you are in an (obspy) environment that it doesn't mean that jupyter was also installed in that environment. Which means that your PATH will provide a "jupyter" command, but this command will launch in the root environment, not in (obspy). So, make sure to "conda install -c conda-forge jupyter" etc... in the (obspy) env.
Problems like this is why I put the following in bold in our Anaconda installation instructions in our wiki:
base environment for anything besides updating the conda package itself (if necessary)"Because I've seen so many puzzled people running "binaries" from the base environment while in a different environment and assuming that anything they execute must surely run in that environment.
(Just guessing that this is the problem, as we still wait for feedback if the problem is resolved.. but usually it is)
true...
but i would also suggest for "first time" users to just recommend working in the base env... because using Anaconda, the jupyter exe in the base even before you create the obspy env... for example.
but i would also suggest for "first time" users to just recommend working in the base env...
Yes and no. What anaconda should do is protect the base environment, such that installing any other packages then what is needed for conda is impossible. But.. at the same time they should make a separate environment (e.g. default) that is active by default but not added to the PATH unless active (like base is usually, unless you opt out during install -- which new users likely not do, I also have base on my PATH..)
At least that's the best practice I see (and apply myself) after seeing many, many people (me initially as well) stumble over these same issues over and over again.
Hi,
Indeed, the problem was that the jupyter notebook was called from the root environment, and not installed in the separate obspy env.
Thanks a lot for your help !
The problem is solved
Good to hear.. :-)
Most helpful comment
note also, if you followed the instructions are you are in an (obspy) environment that it doesn't mean that jupyter was also installed in that environment. Which means that your PATH will provide a "jupyter" command, but this command will launch in the root environment, not in (obspy). So, make sure to "conda install -c conda-forge jupyter" etc... in the (obspy) env.