I have a problem with chapter 4 of this book. I run python shell (IDLE, python 2.7) and try to import apihelper module, but I keep getting traceback saying
No module named apihelper
I downloaded the code from Pilgrim's site, but it still doesn't work. What do I miss?
That's because your Python interpreter doesn't know where did you download apihelper module, and it cannot import it.
More about where does import look for packages you can read here in Dive into Python book.
Related
I'm trying to work on some old code that used a library I'm not very familiar with anymore, and am getting the 'No module named' error. I'm using sublime text editor on windows. I had edited some things in build to run c++ previously if that might effect it.
If the library in particular matters, it is youtube_dl
I have tried $pip install -upgrade youtube_dl but it hasn't changed anything.
The code that is throwing an error is import youtube_dl
I searched around on the internet, and I found an answer.
(Edited for clarity)
”Sublime is a module only available in Sublime Text embedded Python interpreters.
import sublime will only work from a plugin or inside the console, not on your system Python interpreter.”
The forum post is here.
Not sure if this will help, as I do not know if you are trying to import sublime, but this is literally all the info I could find.
Hopefully this helps!
I don't know whether I've just installed them wrong or there's another problem. I installed the ebay sdk but whenever I try to import it I get
ModuleNotFoundError: No module named 'ebaysdk'
Are there any common problems with this I could check for a solution? It shouldn't be the code as I copied it from the example code off the website.
Thanks for any help.
P.S I'm using 3.6
In my python code I want to use a module called "topicmodels" (that can be found here https://github.com/sekhansen/text-mining-tutorial). The problem with this module is that whenever I want to "import topicmodels" in my Python code, I get the error message:
ImportError: No module name preprocess, more specifically in that topicmodels module is a Python file init.py that contains the line " from preprocess import * ". I googled and did not find a python module called preprocess - can anybody help me out on this?
(I am using Kubuntu and Python 3.5.2 | Anaconda 4.2.0).
Thanks a lot for any help!
This code is written for Python 2. You're on Python 3. The failing import is an implicit relative import, which Python 3 prohibits.
Run it on Python 2.
pip install preprocessing
Reference: https://pypi.org/project/preprocessing/
I don't have a lot of programming experience, so please try to keep answers relatively noob-friendly! :) Basically, I have a Python...library, I guess? or module? that I need to run in Spyder through Anaconda. This seems to be a very obscure module called PySPM, used for analyzing scanning probe microscopy data, that I received from a colleague my lab collaborates with. When I try to run a piece of software which uses this module, it gives this error:
ImportError: No module named 'PySPM.io'
The code itself which triggers this reads as follows:
from os import path
from PySPM.io.Translators.Utils import uiGetFile
from PySPM.io.Translators.BEPSndfTranslator import BEPSndfTranslator
from PySPM.io.Translators.BEodfTranslator import BEodfTranslator
from PySPM.analysis.BESHOFitter import BESHOFitter
The first line that says from PySPM.io.Translators.Utils import uiGetFile is what's triggering the error. I'm really stuck scratching my head here. What's going on and how can I solve it?
Pycroscopy is the (thoroughly) reorganized version of PySPM.
#Martensite try:
$ pip install pycroscopy
I have been banging my head against the wall trying to get Exscript installed. After multiple failed attempts at doing it manually, I installed ActivePython and had success running "pypm install Exscript" from the cmd prompt.
I am now going through the Exscript documentation (found here https://github.com/knipknap/exscript/wiki/Python-API-Tutorial) and if I run the first example script I get an error:
>>> from Exscript.util.interact import read_login
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
from Exscript.util.interact import read_login
ImportError: No module named interact
So, I understand that this is saying that there is no module interact. How can I check this? Is there a way I can manually add this module? I would love to know WHY this module didnt come with the package, but that may be impossible to answer :)
Any and all help is greatly appreciated. Thank you
EDIT -
import Exscript.util works but if I try import Exscript.util.Interact I get the error. When I look in util.py I see an entry that says "from FooLib import Interact". I first thought it may just be a capitalization error (Exscript.util.interact vs util.Interact) but neither of those work. I am not sure where to go from here... :(
EDIT -
I have posted this question on the developers forums, hopefully he will have an answer for us. https://github.com/knipknap/exscript/issues/15
EDIT -
The developer suggested that I was using an old version and told me to download the latest. I had struggled installing the module manually so I googled how to easily install py modules. I found a writeup on easy_install.exe. I ran "c:\Python26>easy_install C:\Users\support\Desktop\lou\knipknap-exscript-v2.1-70-gf5583f3.tar.gz" from the cmd prompt, the module was installed (no errors) and now when i run the script it works.
Next challenge will be how to get these scripts to run as stand-alone exe's on users computers without Python installed :)
THANK YOU to everyone to commented I truely appreciate your help.
Lou
One common way packages are installed is as directories. So check your site-packages directory for an Exscript directory, and inside that there should be a util directory, and inside that there should be an interact.py file. Look for similar spellings in case the tutorial misspelled something.