Spyder: Spyder finds a module, but not it's submodule. Works in terminal

Created on 22 May 2017  路  5Comments  路  Source: spyder-ide/spyder

Description of your problem

Spyder doesn't find the submodule of a module, although it finds the module fine. Thus it is finding the location but not recognising the file maybe? It loads the submodule fine in a python or ipython session of the terminal

What steps will reproduce the problem?

  1. pip install git+https://github.com/markcwill/hashpy.git
  2. run spyder
  3. import hashpy

What is the expected output? What do you see instead?
Expected output is for it to load normally. It loads normally in a python or ipython session in the normal terminal window. However in Spyder, it seems to only find the normal module (hashpy) and not the submodule (libhashpy) and produces the following error:

import hashpy
Traceback (most recent call last):

  File "<ipython-input-4-c4b8cd1c5277>", line 1, in <module>
    import hashpy

  File "hashpy/__init__.py", line 13, in <module>
    from hashpype import HashPype, HashError

  File "hashpy/hashpype.py", line 22, in <module>
    from hashpy.libhashpy import (mk_table_add, angtable, ran_norm, get_tts, get_gap,

ImportError: No module named libhashpy

The file with libhashpy is directly within the normal module's folder:
/home/user/anaconda2/lib/python2.7/site-packages/hashpy
image

Please provide any additional information below
I have already done the following:

  • uninstalled and reinstalled Spyder
  • updated conda and spyder to the newest versions
  • uninstalled and reinstalled hashpy
  • added the exact path of hashpy's site-packages folder to the PYTHONPATH window in Spyder
  • ran out of ideas

Versions and main components

  • Spyder Version: 3.1.4
  • Python Version: 2.7.13 64bit
  • Qt Version: 5.6.2
  • PyQt Version: PyQt5 5.6
  • Operating system: Ubuntu 16.04 LTS

Dependencies

Please go to the menu entry Help > Optional Dependencies (or
Help > Dependencies), press the button Copy to clipboard
and paste the contents below:
jedi >=0.9.0 : 0.9.0 (OK)
matplotlib >=1.0 : 2.0.2 (OK)
nbconvert >=4.0 : 5.1.1 (OK)
numpy >=1.7 : 1.12.1 (OK)
pandas >=0.13.1 : 0.20.1 (OK)
pep8 >=0.6 : 1.7.0 (OK)
psutil >=0.3 : 5.2.1 (OK)
pyflakes >=0.5.0 : 1.5.0 (OK)
pygments >=2.0 : 2.2.0 (OK)
pylint >=0.25 : 1.6.5 (OK)
qtconsole >=4.2.0: 4.3.0 (OK)
rope >=0.9.4 : 0.10.5 (OK)
sphinx >=0.6.6 : 1.6.1 (OK)
sympy >=0.7.3 : 1.0 (OK)

IPython Console Bug

All 5 comments

What happens if you start Spyder from a terminal? Does importing hashpy work in that case?

I always start from terminal because, as you suggest, sometimes things don't work when started from a shortcut. And nope, it doesn't import correctly when spyder is started from a terminal. Does it work on your machine?

I'll try it and let you know what happens in my case.

Another note: It also doesn't work in the normal python console of the Spyder IDE. I'm not sure if it's a true, pure python console or if there's more happening behind the scenes but I would guess that that implies that it's something deeper not working than the iPython console?

The latest update to that project was 5 years ago. I do not think this is specific to Spyder. Closing.

Was this page helpful?
0 / 5 - 0 ratings