python noob here. Just start picking up python few weeks ago and currently need some help. I have 3.3.4 python for windows 7 and I tried running this:
import urllib.request
from googlevoice import Voice
from googlevoice.util import input
import time
File "<pyshell#0>", line 1, in <module>
from googlevoice import Voice
ImportError: No module named 'googlevoice'
so I figured. no big deal, I just need to install the module. I obtained a setup.py file from the link below and ran the file in different directories. Then tried " import googlevoice" but still doesn't work. The github link isn't too helpful, in terms of installing this module. Please help? I think I just have not learned how to install modules properly. Last time it took me a while to install pygame module, but i think it was because of directory issues at first.
https://pygooglevoice.googlecode.com/hg/
http://sphinxdoc.github.io/pygooglevoice/examples.html
To install the PyGoogleVoice, you need to download the whole archive and execute:
python setup.py install
If you have pip install, you can also run pip install pygooglevoice, or easy_install pygooglevoice with EasyInstall, without having to download the source code.
Related
I am attempting to Import PyPDF2 in order to read a PDF file and parse through it. I am using a Raspberry Pi, and have installed PyPDF2 using the command pip install PyPDF2. However, when I try importing it, I am getting ModuleNotFoundError.
I think it may have installed it into the wrong location. When I do python -V it says I am using version 2.7.16. But the error states it's trying to look into the python3 folder?
I am attempting to import it using the line import PyPDF2
The error I'm getting is:
Traceback (most recent call last):
File "/home/pi/SqlDatabase.py", line 5, in <module>
import PyPDF2
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 305, in _custom_import
module = self._original_import(*args, **kw)
ModuleNotFoundError: No module named 'PyPDF2'
Any idea of how I can install PyPDF into the correct directory, or perhaps a different solution?
If you are starting the program with python3 (e.g. see if the first line of the file has #!/usr/bin/python3 or similar), you need to install the library with pip3.
It seems that you have not installed PyPDF2 module in your device.
Execute following code in your terminal:
pip install PyPDF2
or
pip3 install PyPDF2
I think this will solve your problem. If this does not solve your problem, then there may be problem in your directory of python.
I have also faced the same issue. Note that Python is a case-sensitive language.
While using the import command use PyPDF2 and not pyPDF2
To install:
pipenv install PyPDF2
To import:
import PyPDF2
I am trying to get the JapaneseTokenizer working in python, but I am having trouble with one of the modules it depends on. Here is the trace of the errors I am getting:
/Users/home/PycharmProjects/SubLingo/application/tokenizerTest.py
Traceback (most recent call last):
File "/Users/home/PycharmProjects/SubLingo/application/tokenizerTest.py", line 1, in <module>
import JapaneseTokenizer
File "/Users/home/PycharmProjects/SubLingo/venv/lib/python3.7/site-packages/JapaneseTokenizer/__init__.py", line 6, in <module>
from JapaneseTokenizer.jumanpp_wrapper import JumanppWrapper
File "/Users/home/PycharmProjects/SubLingo/venv/lib/python3.7/site-packages/JapaneseTokenizer/jumanpp_wrapper/__init__.py", line 1, in <module>
from .jumanpp_wrapper import JumanppWrapper
File "/Users/home/PycharmProjects/SubLingo/venv/lib/python3.7/site-packages/JapaneseTokenizer/jumanpp_wrapper/jumanpp_wrapper.py", line 2, in <module>
from pyknp import Jumanpp
ImportError: cannot import name 'Jumanpp' from 'pyknp' (/Users/home/PycharmProjects/SubLingo/venv/lib/python3.7/site-packages/pyknp/__init__.py)
As you can see Jumanpp_wrapper is trying to import the module Jumanpp from pyknp. I have looked into the pyknp package currently installed on my machine and it does not have a module with this name. This leads me to conclude that the version of pyknp I have installed is not compatible with Jumanpp, so there must be another version available somewhere. The trouble is I install pyknp using the pip installer on my Mac, as recommended on the pyknp official site, so it should be the most current version. I'm not sure how to get an alternative version that contains the necessary module. I hope someone can point me in the right direction.
I'm a developer of the package. I kindly thank you for using my package.
I fixed bugs related to the issues here and released newer package version 1.4.
https://github.com/Kensuke-Mitsuzawa/JapaneseTokenizers/releases/tag/1.4
You could install/upgrade the package with pip also.
Install pip install JapaneseTokenizer / Upgrade pip install -U JapaneseTokenizer
I have been in direct contact with the developer of JapaneseTokenizer who has kindly given permission for me to repost his answer to my query:
I'm glad that you sent me a message about the issue. I read your post at StackOverflow. As other user suggested, the main issue is that pyknp package does not have juman++ module. I don't know the reason, but an author of pyknp package removed module for juman++.
The straightforward way to solve this issue is that you install pyknp package version 3 from here and install it your environment.
The main procedure is below.
remove pyknp package from your environment pip uninstall pyknp
get download pyknp package previous version. http://nlp.ist.i.kyoto-u.ac.jp/DLcounter/lime.cgi?down=http://lotus.kuee.kyoto-u.ac.jp/nl-resource/pyknp/pyknp-0.3.tar.gz&name=pyknp-0.3.tar.gz
install the pyknp=0.3 with pip install pyknp-0.3.tar.gz
From now, I revise JapaneseTokenizer package. It might take some weeks. Next time you try to install JapaneseTokenizer package, everything will be fine.
Again, thanks for giving me a message.
Best,
Kensuke Mitsuzawa
I downloaded multiple modules (Discord API, cx_Freeze) (pip download, Windows 10) and now I wanted to use them.
But when I want to import them, it says there isn’t any module.
From my former Python using (before resetting computer) I‘ve added a pycache folder and it worked for one module. I‘m not able to reproduce it for other modules. What to do?
I‘ve only one Python version (3.6.5) on PC.
I‘ve checked the \site-packages folder and they‘re there.
If you are using python3 then try downloading the library using
pip3 install libname
but if you are using python2 then install the library using
pip2 install libname or just pip install libname
try with these command and reply
try installing your library using the command prompt in normal user and with the admin user so that you will get to know that what is happening and also if it is still not working then try installing the library into the same folder of your project using pip custom install command
pip install -t <direct directory> <package>
then use the import statement
For Example I used
pip2 install -t c:\Users\Nav\Desktop\projectss cx_freeze
then i imported the library using
#from cx_Freeze import setup, Executable
import cx_Freeze
from cx_Freeze import *
it worked.
Previously i was getting error like :
File "C:\Python27\lib\site-packages\cx_Freeze\__init__.py", line 10, in <module>
from cx_Freeze.finder import *
ImportError: No module named finder
After custom install it is working
I need to use netcdf but do not have install permission for python modules. I have downloaded netcdf-0.1.2.tar.gz from here: https://pypi.python.org/simple/netcdf/ and unzipped the tar ball. I have been following this stack overflow post in an attempt to use the module but have had no luck so far:
(Python) Use a library locally instead of installing it
here is what I have tried:
Installing virtualenv:
I do not have permission to do this
python setup.py install -- user:
again, I don't have permission
running my script with netcdf as my current working directory:
I tried this as well, here are the issues I have run into:
first I went into netcdf-0.1.2 and made a new file called asdf.py
which contains the following:
import netcdf
print("testing")
running python asdf.py gives the following error:
Traceback (most recent call last):
File "asdf.py", line 1, in <module>
import netcdf
File "/.../Downloads/netcdf-0.1.2/netcdf/__init__.py", line 1, in <module>
from netcdf import *
File "/.../Downloads/netcdf-0.1.2/netcdf/netcdf.py", line 1, in <module>
from netCDF4 import Dataset, numpy
ImportError: No module named netCDF4
I'm not sure how to fix this error, any help would be greatly appreciated
in case this is somehow relevant, the version of Linux I am using is 3.2.0-23-generic
also I have numpy installed already
Easest would be to install Anaconda or Miniconda with your user rights.
Anaconda already as netCDF4installed. In case of Miniconda install with:
conda install netcdf4
If you have Python 3 installed, then you will have the venv package in the standard library, so you do not need "virtualenv" to be installed for you separately (as would be the case with Python 2). Instead use python3 -mvenv , in a similar way to how you would use virtualenv, for example:
python3 -mvenv /path/to/my_venv
or to include any non-standard packages already installed on the system:
python3 -mvenv --system-site-packages /path/to/my_venv
After that, you should be able to activate the environment and pip install packages, e.g.
source /path/to/my_venv/bin/activate # for csh use activate.csh instead
pip install netCDF4
Remember to source the activate script at run time as well as installation time:
source /path/to/my_venv/bin/activate
python
and you should then find that in your python session you have the netCDF4 package available, e.g.
import netCDF4
my_dataset = netCDF4.Dataset('myfile.nc')
Of course, substitute the actual path in place of /path/to/my_venv above.
None of this requires any root privileges.
(And as someone else has suggested, another option for you is to use conda.)
I'd also like to highlight that the package is imported using capitals
import netCDF4 as nc
This might not matter on a mac, but for Windows it is key.
When I am trying to install tweepy module for python on windows 7, I type in easy_install tweepy
and it gives me the error of:
ImportError: No module named pip.req
I already read the link below but I am a newbie and didnt understand it:
No module named pip.req
PLEASE HELP!!
You should look inside the file setup.py in your folder with downloaded tweepy.
There you could find the line:
from pip.req import parse_requirements
setup.py tries to import parse_requirements function from module req from package pip.
But inside tweepy folder there are no pip package with req.py python module. Read about Python packages and modules here.
So you need to do the steps from the answer https://stackoverflow.com/a/25193001/821093 to fix it.
You can do a simply one line command as suggested by Tweepy installation
Or you can download the file yourself and put on your desktop (or wherever you like). From the windows command type:
cd deskstop\tweepy-master # tweepy-mast is defaul name from the zip download
python steup.py install
You can access the command prompt window using the "Window key" + "R" then type "cmd".