How to use blist module without installing it? - python

Without installing blist, I am trying to use blist_1.3.6 module by setting the environment variable PYTHONPATH. However I am still getting the error below. Is there any way to use this _blist without installing it? I can see _blist.c is C language file.
File "/path/blist-1.3.6/blist/__init__.py", line 2, in <module>
from blist._blist import *
ImportError: No module named _blist

_blist is the module implemented by the object that results from compiling _blist.c and creating a shared library from it. You can't simply import _blist.c directly.

Related

ImportError: No module named 'kzyvad'

I want to start up a project, which imports a module named kzyvad. It occurs error ImportError: No module named 'kzyvad'. However, if I execute pip install kzyvad, it returns ERROR: Could not find a version that satisfies the requirement kzyvad.
Did someone ever successfully install kzyvad?
I don't know where you found your module but I looked for it and I could not find it, I think the guy who wrote 'kzyvad' did a mistake while writing, and if pip gives you this error, it means it doesn't exist.
If this kzyvad.py is written by you, then keep this file/module in a same folder and do this in main.py file:
from kzyvad import *
You can use it's functions and classes in your main.py file

I got an error when calling kmodes module in python

When calling the kmodes package like this:
# I have also tried
# from kmodes.kmodes import KModes
from kmodes.kprototypes import KPrototypes
ModuleNotFoundError: No module named 'kmodes'
As suggested by #648trindade, all I had to do was install the package. That's not included in Anaconda by default.
I had same issue. It turned out that I named my test file as kmodes.py, and current directory is in sys.path. so python use my test file as the library.
If you have set the system path to some folder having kmodes.py file, just rename your script as something else, everything is fine.
Or you just remove the sys.path line from the code and restart the compiler

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

What does ImportError mean in Python?

I try to import a module:
import cv
And I get the following error message:
ImportError: DLL load failed: The specified module could not be found.
But if I try to import a library that definitely does not exist, for example:
import blabla
I get:
ImportError: No module named blabla
So, I conclude the the cv library is not totally hidden. Python is able to see something. Does anybody know what Python is able to see and what is missing?
ADDED
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ADDED 2
In the directory that contains the cv library there is sub-directory (C:\OpenCV2.2\bin) with many *.dll files. So, I tried:
import sys
sys.path.append("C:\OpenCV2.2\bin")
and I still get the "dll load failed". Is there a way to find out which exactly "dll" file is missing. I mean, Python tries to find a specific dll file (let say cv.dll) and cannot find it?
In this particular case, "DLL load failed" is caused by using Python 2.6 with OpenCV 2.2. You should use Python 2.7, because cv.pyd is linked with python27.dll.
ImportError can be confusing because it can be thrown when the module you are trying to import tries to import something else and because all of the import code is written in C you don't always get a useful backtrace.
In this case it looks as though either cv itself is a DLL, or some module that it tries to import is a DLL. The DLL won't load because it depends on some other DLL that isn't present on your system.
If you can't easily see what dependency is missing you can try using Microsoft's 'depends' tool to find out.
Most probably Python finds the pure-python module cv, which cannot find a DLL it needs.

Categories

Resources