Error Upgrading to Obspy 0.10.2_2 from 0.9.2_0

Greetings,

I have attempted to upgrade my Obspy package on my Mac OS 10.9.4 (Mavericks) from the previous version I was using (0.9.2_0) to 0.10.2_2, following the installation direction directions using MacPorts. I updated MacPorts using the self update command, and then I used [sudo port upgrade py27-obspy] to upgrade obspy, per the instructions on the installation page. From what I could tell, the upgrade completed successfully. So, I try to run a basic script which calls the obspy.core module, and I receive the following error:

Traceback (most recent call last):

File “Python_gui.py”, line 2, in

from obspy.core import read

File “/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/init.py”, line 38, in

version = _getVersionString(abbrev=10)

File “/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/core/util/version.py”, line 147, in get_git_version

release_version = read_release_version()

File “/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/core/util/version.py”, line 133, in read_release_version

with io.open(VERSION_FILE, “rt”) as fh:

LookupError: unknown encoding:

I was wondering what other steps need to be taken so that Obspy is upgraded successfully? From the error, it looks like some sort of version issue with Obspy, because if I run a Python script that does not call an Obspy module, the script runs fine.

Thanks for your help,

Greg

Greetings,

I have attempted to upgrade my Obspy package on my Mac OS 10.9.4 (Mavericks) from the previous version I was using (0.9.2_0) to 0.10.2_2, following the installation direction directions using MacPorts. I updated MacPorts using the self update command, and then I used [sudo port upgrade py27-obspy] to upgrade obspy, per the instructions on the installation page.

I am not completely sure what is the issue here, but I’d assume that the installation went well. I tested with Mountain Lion and Yosemite, not with Mavericks, but the buildbot had no issues and the binary packages is available. Anyway, you can check with

  port installed py27-obspy

to see the installed versions. You could if needed even re-activate the older version.

Moreover, you can try to run the test suite with

  obspy-runtests-2.7

and see what happens. Expect some tests to fail due to a known issue with pep8 vs. flake8 incompatibility.

From what I could tell, the upgrade completed successfully.

Yes, you can easily confirm this (see above).

So, I try to run a basic script which calls the obspy.core module, and I receive the following error:

Traceback (most recent call last):

  File "Python_gui.py", line 2, in <module>

    from obspy.core import read

I cannot reproduce this. For me this import works just fine.

Can you confirm that the right version is installed. For me this is …

py27-obspy @0.10.2_2

and that you are really calling the desired Python version. That is Python 2.7 from Macports.

What does which python give you?
When you call the interpreter of Macports directly (/opt/local/bin/python2.7) and try the above import manually what happens?
What happens when doing just import obspy?
Which version you get when executing the following command:
  print obspy.__version__

  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/__init__.py", line 38, in <module>

    __version__ = _getVersionString(abbrev=10)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/core/util/version.py", line 147, in get_git_version

    release_version = read_release_version()

  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/core/util/version.py", line 133, in read_release_version

    with io.open(VERSION_FILE, "rt") as fh:

LookupError: unknown encoding:

I was wondering what other steps need to be taken so that Obspy is upgraded successfully? From the error, it looks like some sort of version issue with Obspy, because if I run a Python script that does not call an Obspy module, the script runs fine.

First, you need to understand if you upgrade was successful or not. The binary packages works just fine, but there is some chance that you did not receive it (there were some network issues recently) and build from source locally, which by itself usually works just fine as well.

With the extra info, we should get some clue.

Cheers!
~petr

Hi Petr,

Here is more information that will hopefully resolve this error.
(1) After upgrading to Obspy 0.10.2_2 and receiving the error, I reactivated my previous version (0.9.2), by sudo port activate py27-obspy @0.9.2, and that version runs smoothly.

Now, with the new obspy installed, I reactivated the updated version by sudo port activate py27-obspy @0.10.2_2, which produces this output, which I assume to be expected:

—> Computing dependencies for py27-obspy
—> Deactivating py27-obspy @0.9.2_0+gcc48
—> Cleaning py27-obspy
—> Activating py27-obspy @0.10.2_2
—> Cleaning py27-obspy

(2) After running the test suite obspy-runtests-2.7, I receive the same error as I what I received before.

(3) which python returns /opt/local/bin/python, not /opt/local/bin/python2.7, which I would have expected.

(4) port installed py27-obspy returns:

The following ports are currently installed:
py27-obspy @0.9.2_0+gcc48
py27-obspy @0.10.2_2 (active)

(5) When just importing obspy directly, I get the same error message as before.

I may try to uninstall 0.10.2 and reinstall it to see if the issue had to do with the install.

Hopefully the information above was helpful, and I hope to get this resolved soon!

Thank you,

Greg

Here is more information that may be helpful. I uninstalled 0.10.2 and reinstalled it, and the installation appeared to be successful; however, I still receive the same error as before. I am positive that this is an obspy install issue rather than a Python install issue, because I have other scripts that call other modules such as matplotlib, and I having no problems importing those modules. I receive the error when attempting to access modules in the Obspy package. Thanks for your help.

Greg

Okay, this is a bit puzzling …

Here is more information that may be helpful. I uninstalled 0.10.2 and reinstalled it, and the installation appeared to be successful; however, I still receive the same error as before. I am positive that this is an obspy install issue rather than a Python install issue, because I have other scripts that call other modules such as matplotlib, and I having no problems importing those modules. I receive the error when attempting to access modules in the Obspy package. Thanks for your help.

But your probably right, that this appears to be an issue with Obspy in Macports, especially because downgrading seems to resolve the issue.

Greg

Hi Petr,

Here is more information that will hopefully resolve this error.
(1) After upgrading to Obspy 0.10.2_2 and receiving the error, I reactivated my previous version (0.9.2), by `sudo port activate py27-obspy @0.9.2`, and that version runs smoothly.

Now, with the new obspy installed, I reactivated the updated version by `sudo port activate py27-obspy @0.10.2_2`, which produces this output, which I assume to be expected:
---> Computing dependencies for py27-obspy
---> Deactivating py27-obspy @0.9.2_0+gcc48
---> Cleaning py27-obspy
---> Activating py27-obspy @0.10.2_2
---> Cleaning py27-obspy

Looks good!

(2) After running the test suite `obspy-runtests-2.7`, I receive the same error as I what I received before.

Okay, this is at least consistent.
But I cannot reproduce, so there seems to be something specific on with your system. I unfortunately have no way to test on Maverick, but I’d rather point to some specific setup causing this.

(3) `which python` returns `/opt/local/bin/python`, not `/opt/local/bin/python2.7`, which I would have expected.

This is okay, you are asking for a the python executable which would be executed. `/opt/local/bin/python` is a link, which is setup by `port select python …`, probably this is set to python2.7 on your system, but you can just check it.

(4) `port installed py27-obspy` returns:
The following ports are currently installed:
  py27-obspy @0.9.2_0+gcc48
  py27-obspy @0.10.2_2 (active)

Good!

(5) When just importing obspy directly, I get the same error message as before.

That’s of cause not good ...

I may try to uninstall 0.10.2 and reinstall it to see if the issue had to do with the install.

Do you by chance know if it was installed from binaries or from source?

BTW: You could control this by forcing either of this be a -b or -s flag. So you could if this makes the difference. However, this should not be the case.

Just to be sure:
Have you installed python with the default variants?
In particular have you by chance installed with the +ucs-4 variant?

[...]

> Traceback (most recent call last):
>
> File "Python_gui.py", line 2, in <module>
>
> from obspy.core import read

[...]

> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/__init__.py", line 38, in <module>
>
> __version__ = _getVersionString(abbrev=10)
>
> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/core/util/version.py", line 147, in get_git_version
>
> release_version = read_release_version()
>
> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/core/util/version.py", line 133, in read_release_version
>
> with io.open(VERSION_FILE, "rt") as fh:
>
> LookupError: unknown encoding:

Is it possible that the last line is incomplete?
Or is there really nothing after `unknown encoding:`?