I have installed kornia and imorting it like,
from kornia.color import *
import kornia.augmentation.functional as F_k
import kornia as K
but the second line is giving error
ModuleNotFoundError: No module named 'kornia.augmentation.functional'.
Also, this is my directory structure.
But I getting error
ModuleNotFoundError: No module named 'FewShot_models'
when I try to import from FewShot_models.manipulate import *.
I am following a code from github and trying to implement that.
kornia.augmentation.functional was removed in version 0.5.4 and the most of the functions are available through kornia.augmentation.
Regarding your second question, you need to add empty file named __init__.py to FewShot_models directory. Check this answer for details about __init__.py.
Related
I have my own python module in a custom location here:
/mydata/python/mylibrary/mymodule.py
for linux, or for Windows:
C:\mydata\python\mylibrary\mymodule.py
There are no other files or folders in the directory “mylibrary”.
When I try and import this module into a python program with the statement:
import mymodule
I get an error like this:
ModuleNotFoundError: No module named 'mymodule'
What do I need to do to make this module import work?
need help, tried everything
I have added:
export PYTHONPATH="${PYTHONPATH}:/home/twittercap/alchemyapi"
to my ~/.profile file (ubuntu server environment) and it shows when I run
import sys
print sys.path
but it won't let me import the module using
from alchemyapi import AlchemyAPI
(which I can when running from within the directory.
Any help is appreciated.
Update:
I can now import alchemyapi but import alchemyapi.AlchemyAPI returns ImportError: No module named AlchemyAPI (but there is!)
Resolved: Git cloned again and didn't rename - either the rename messed it up, or else the files corrupted the first time - thanks for your suggestions though!
I'm trying to run Tensorflow's translate.py from a python console rather than through bazel -build, but I get an error at these two lines:
from tensorflow.models.rnn.translate import data_utils
from tensorflow.models.rnn.translate import seq2seq_model
ImportError: No module named translate
I've checked the folder to see that the "init.py" file is there, but python seems to think there is no such module as translate.
How can i fix this?
The best way to do this is to navigate to folder containing the translate module and running it. You can also download the translate module to any other place and run it. However, don't forget to change the above lines to:
from translate import data_utils
from translate import seq2seq_model
I resolved this issue by removing all the from tensorflow.models.rnn.translate statements, leaving just
import data_utils
import seq2seq_model
in translate.py and
import data_utils
in seq2seq_model.py.
I have installed PyML package in order to use some machine learning algorithms, and according to the tutorial, my installation is successful.
I try to run a python script which includes the following line to import modules from PyML
from PyML import datafunc,svm,assess,modelSelection,ker
However I get the error message above saying
File <stdin>, line 1, in <module> ImportError: cannot import name
datafunc
cannot import name datafunc`. From terminal I check every module by saying
from PyML import datafunc,
from PyML import svm,
from PyML import ker
I only get error message for datafunc. The PyML library is under the site-packages folder of Python 2.7.
I check this question here Python error: ImportError: cannot import name Akismet, but I could't see how it will help my problem.
Do you have any idea why Python imports some modules but does not import this one?
In PyML-0.7.13.3, the datafunc module exists in PyML/containers directory.
So it seems that you can import the module as follows:
from PyML.containers import datafunc
Howerver, it raises an error beacuse the datafunc module uses
undefined classes BaseVectorDataSet and SparseDataSet.
Thus you need to modify the source of PyML
in order to use datafunc module.
First, prepend the following two lines to PyML/containers/datafunc.py
and re-install the PyML library.
from PyML.containers.baseDatasets import BaseVectorDataSet
from PyML.containers.vectorDatasets import SparseDataSet
Then you can import the modules as follows:
from PyML import svm, modelSelection, ker
from from PyML.containers import datafunc
from from PyML.evaluators import assess
BTW, I recommend that you use more documented and tested machine learning library, such as scikit-learn.
I have installed a third party library according to its instruction using
python setup.py install
the library is now located in C:\Python27\Lib\site-packages.
However when calling
from myLib.toolkit.rd import myFunction
I get an error:
ImportError: No module named toolkit.rd
The folder structure is myLib->toolkit->rd.py. myLib and toolkit folder contain an __init__.py. I also added the path to python path environment variable but that did not help either.
So I'm kind of lost why this isn't working?
EDIT:
from myLib.geometry import distance_to_point
where geometry.py contains function distance_to_point results in following error:
ImportError: No module named geometry
So something with this library is just wrong. I have a lot of other libs installed and they all work with no issue. Note that I did restart PC. Just to make sure...
Maybe you have myLib/__init__.py not empty with an __all__ definition that not expose toolkit submodule.