ModuleImportError in library - python

I'm using a Python library (pyPyrTools), which is giving me an import error.
../../../venv/lib/python3.8/site-packages/pyPyrTools/__init__.py:1: in <module>
from binomialFilter import binomialFilter
E ModuleNotFoundError: No module named 'binomialFilter'
Inspecting the module in venv/lib/site-packages, I find the following structure:
-pyPyrTools
---__init__.py
---binomialFilter.py
And inspecting __init__.py, it's a pretty standard fare import:
from binomialFilter import binomialFilter
binomialFilter.py does include a function called binomialFilter.
Any idea why I'm getting this error from this library? There aren't any relative imports or anything funky, and the files all exist on the right level. It all looks correct to me.
The module looks like it was written for 2.7, and I'm using 3.8 if that is relevant.

Related

ImportError: cannot import name 'EXTRACTOR_FILENAME' from 'talon.signature'

I am having trouble getting an import statement to work. I am attempting to use this package:
https://github.com/mailgun/talon
I am running the following command:
from talon.signature import EXTRACTOR_FILENAME, EXTRACTOR_DATA
I get the following error:
ImportError: cannot import name 'EXTRACTOR_FILENAME' from 'talon.signature' (system path to file)
While troubleshooting I don't see EXTRACTOR_FILENAME or EXTRACTOR_DATA defined anywhere. I did a search in directory for all files. Is there some sort of convention in python where EXTRACTOR_FILENAME maps to a specific class?
UPDATE: Figured it out, just something as simple as manually defining the 2 constants. The docs weren't exactly clear or I missed it.
For your project the import looks like this:
import talon
from talon import quotations
Put those statements on the top of your file, and it should work.
if you don't have the packages on your system type this in your terminal:
pip install talon
The Github repo also explains this

No module named zope.index

Getting the following error when trying to import a lib that depends on zope
No module named zope.index
my python path is correct (I can import other libs)
I already created an init.py file in the zope folder but it still isnt working so Im not sure what I might be missing
currently using python 3.7
*edit
Error:
File "C:\Users\vitor.valentim\AppData\Local\Programs\Python\Python37\Lib\dedupe\tfidf.py", line 5, in
from .canopy_index import CanopyIndex
File "C:\Users\vitor.valentim\AppData\Local\Programs\Python\Python37\Lib\dedupe\canopy_index.py", line 3, in
from zope.index.text.lexicon import Lexicon
ModuleNotFoundError: No module named 'zope.index'
zope path
zope.index path
The error message No module named zope.index implies that import found a package zope, but then failed to find zope.index (otherwise the error message would be No module named zope).
Try
import zope
print(zope)
and see what that resolves to, something like this often happens if there is something shadowing the package you're trying to import.

How to import things in Python stub files?

I'm annotating types for the aiojira library using stub files. aiojira library follows the same structure as jira library. jira library contains resilientsession module, so I think I should create resilientsession.pyi file and import it in __init__.pyi. I did this, but when write:
import aiojira.resilientsession
PyCharm complains, mypy complains:
kgjirawebhook/__init__.py:7: error: Cannot find module named 'aiojira.resilientsession'
How do I fix this?
This might be because aiojira is not installed in your current environment. Relative import should fix this problem.
Try:
from . import resilientsession

ImportError: No module named X, even if folder is in the same directory

I've downloaded pymumble from https://github.com/Robert904/pymumble and saved it to my working directory. I import it with:
from pymumble import pymumble
However, I receive:
ImportError: No module named pymumble
I'm looking at similar code that does this successfully. What am I doing wrong when trying to import this?
As I can see there is no file called pymumble in given repository, if you are looking for this there is a file called mumble.py, try importing
from mumble import mumble
this will work.

No module named "xyz" in python 3.4

I am new to python so this could be a wrong question to ask .I have installed python 3.4 and is trying to convert an old project of python 2.2 to python 3.
I have the pythonpath as "C:\ABC;C:\XY"
I do have the following structure :
In the install.py, there is code to import MiscUtils.Utils1.py:
from MiscUtils import Utils1
But in the Utils1.py , another code is there to import Utils2.py:
from UserUtils import Utils2
When I execute the install.py, I am getting the following error:
"No module named Utils2"
I tried many a things but its not working. If I put in the Utils1.py the following:
from .UserUtils import Utils2
I am getting "No Module named MiscUtils.UserUtils"
How can I import all these modules correctly
?

Categories

Resources