question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mp-v2commented, May 23, 2017

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?

1reaction
ccordoba12commented, May 22, 2017

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't import my own modules in Python - Stack Overflow
In your particular case it looks like you're trying to import SomeObject from the myapp.py and TestCase.py scripts. From myapp.py, do import SomeObject....
Read more >
ModuleNotFoundError: No module named x
Project myproject contains two packages, mypackage and anotherpackage each of which contains a number of python modules, while the latter also ...
Read more >
Why Can't Python Find My Modules? - Real Python
A common error that new Pythonistas will come across is that the packages they think they've installed are not actually being recognized by ......
Read more >
git-submodule Documentation - Git
If a git directory of a submodule is inside the submodule, move the git directory of the submodule into its superproject's $GIT_DIR/modules path...
Read more >
runpy — Locating and executing Python modules — Python ...
Source code: Lib/runpy.py The runpy module is used to locate and run Python modules without importing them first. Its main use is to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found