5

I did a fresh python3 installation on OSX via homebrew:

brew install python3

Then I created a virtual environment for my project and installed scipy and scikits.samplerate:

virtualenv -p /usr/local/bin/python3 pythen_env 
pip install scipy
pip install scikits.samplerate

However, when I try to import a function from scikits.samplerate, I get the following error:

>>> from scikits.samplerate import resample
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/my/project/path/pythen_env/lib/python3.6/site-packages/scikits/samplerate/__init__.py", line 4, in <module>
    from info import __doc__
ModuleNotFoundError: No module named 'info'

Info happens to be the first module from the package itself that is imported in __init__.py.

Strangely, the module info.py exists in /my/project/path/pythen_env/lib/python3.6/site-packages/scikits/samplerate/:

ls /my/project/path/pythen_env/lib/python3.6/site-packages/scikits/samplerate/
__init__.py    setup.py        tests        __pycache__
info.py        setuphelp.py    version.py

The error also happens when I try the same without virtualenv, as well as for other packages. How could I start to debug this issue?

Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
Emiswelt
  • 3,909
  • 1
  • 38
  • 56
  • You appear to be using a version of that module for Python 2.x; in 3.x, that should be `from .info ...` – jonrsharpe Apr 02 '17 at 09:48
  • This problem does not occur in Python 2.7. – Martin Thoma Apr 02 '17 at 09:50
  • 1
    I can not switch to Python 2.7 due to a library dependency. How could I make sure that pip installs the correct version? I'd expect pip3 to fetch packages for Python 3 only, but the same error happens. – Emiswelt Apr 02 '17 at 10:01

2 Answers2

3

The problem seems to be that the package scikits.samplerate does not support Python 3.X (see issue). However, there is a fork which supports Python 3.X. You can install it via

$ pip install git+https://github.com/gregorias/samplerate.git

As always: people can make anything they like in repositories. I did not check which changes gregorias made.

Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
2

the git version does support py3

https://github.com/cournape/samplerate

(merged the PR from @gregorias)

I should find the time and procedure to update pypi too...