I need to import the multiprocessing module in Python 2.5.
I've followed the instructions here exactly: http://code.google.com/p/python-multiprocessing/wiki/Install
make and make test run without errors. I've also edited $PYTHONPATH to include the directory where the package is installed.
But 'import multiprocessing' still says: "ImportError: no module named multiprocessing".
What am I doing wrong? Is there some step missing from these instructions? I haven't installed a Python module before.
Navigate to the directory containing the package then type:
python setup.py install
This info was contained in the INSTALL.txt file.
http://code.google.com/p/python-multiprocessing/source/browse/trunk/INSTALL.txt
perhaps you can try:
import sys
sys.path.append('/path/to/processingdotpylibs/')
import processing
Related
I have a python file and the developer of that code has left the organization. When I run the code I get the following error.
import dataAnalysis as DV ModuleNotFoundError: No module named
'dataAnalysis'
I provide below the brief snippet of the python file "main.py" below.
import dataAnalysis as DV
def performCheck():
... other code
... other code
i = DV.addGraph( pathplus)
Here my question is , how to know the actual module or package name of "dataAnalysis" from the above import statement so that I can make "pip install ". However, I tried to install DataAnalysis module, still it does not work.
Is there any way to get the module or package name to install from the import statement in python ?
Go to console or terminal and run command pip install dataAnalysis. If permission denied, then make sure you have enough privilege to install a package.
Update:
In my opinion pip package DataAnalysis is a library that can be used for pre-processing a csv file. As per your given code, it looks like adding a graph so may be it could be a local package. Check dataAnalysis folder in your project with __init__.py file inside.
When running following code, user without error reports normal termination.
python -c "import paramiko"
User with error reports termination (note, no exception) with the following:
/usr/local/lib/python2.7/site-packages/cryptography/hazmat/backends/__init__.py:7: UserWarning: Module _hashlib was already imported from /usr/local/lib/python2.7/lib-dynload/_hashlib.so, but /usr/local/lib/python2.7/site-packages/hashlib-20081119-py2.7-linux-i686.egg is being added to sys.path
import pkg_resources
/usr/local/lib/python2.7/site-packages/cryptography/hazmat/backends/__init__.py:7: UserWarning: Module hashlib was already imported from /usr/local/lib/python2.7/hashlib.py, but /usr/local/lib/python2.7/site-packages/hashlib-20081119-py2.7-linux-i686.egg is being added to sys.path
import pkg_resources
Both users have the same PYTHONPATH, PATH and LD_LIBRARY_PATH. There are no virtual environments on this machine. All .pyc files have been removed on computer and error persists.
Python Version: 2.7.11
OS: CentOS 32 bit el6
pip freeze reports hashlib==20081119 and cryptography==1.7.2 and paramiko==2.1.1
Does anyone have any insight into this problem? I do not understand why one user can perform this task without error, while the other cannot.
Solved it by reinstalling paramiko with pip, ignoring caches and site-packages
I downloaded python-somelib-master.zip from GitHub hoping to use the API it provides. I ran
python setup.py install
And it apparently completed successfully:
Writing D:\SOFT\Python3\Lib\site-packages\python-somelib-1.0-py3.5.egg-info
which then introduced D:\SOFT\Python3\Lib\site-packages\somelib.
However, when I try to import something from there in my script:
from somelib import SubModule
I get
File "D:\SOFT\Python3\lib\site-packages\somelib\__init__.py", line 1, in <module>
from base import SubModule
ImportError: No module named 'base'
I confirmed that base.py is present in D:\SOFT\Python3\Lib\site-packages\somelib.
Did I not properly install the module?
You must install modules dependencies in your machine too. If you are using Ubuntu, you can easily do it with "apt-get". Hope it helps! xD
I am using Ubuntu, and python 2.7. Is there anybody help me overcome the following error?
ImportError: No module named foxhound.utils.vis
which is caused by this line:
from foxhound.utils.vis import grayscale_grid_vis, unit_scale
I also did:
export PYTHONPATH="/home/jerome/bin/django-1.1/lib/python2.6/site-packages:$PYTHONPATH"
but no help!!
If you have already foxhound installed you should use:
from foxhound.vis import grayscale_grid_vis, unit_scale
because vis module is in the foxhound package and not in foxhound.utils (utils is also a module, not a package). See the foxhound structure here.
Edit
To install foxhound:
Download it and unzip it - download link.
In the terminal navigate into the unzipped folder (Foxhound-master).
There run
python setup.py install
More info on installing python modules.
As part of my build system, I am using a modified version of a Python package (cogapp). I don't want to install the package because:
I've modified the package and don't want to worry about collision with unmodified versions which may already be installed.
It's nicer if the users of the build system don't need to install extra packages.
However, I'm having problems with using the package if it's not installed. If it is installed, I can run:
python -m cogapp <additional args>
and everything runs as intended.
The package has a __main__.py script:
import sys
from cogapp import Cog
sys.exit(Cog().main(sys.argv))
I tried running this directly, e.g.:
python -m <path>/__main__ <additional_args>
But I get the error:
...
/__main__.py", line 3, in <module>
from cogapp import Cog
ImportError: No module named cogapp
This is probably related to the error I get if I run __init__.py:
from .cogapp import *
The error is:
from .cogapp import *
ValueError: Attempted relative import in non-package
How can I run the package as a package?
EDIT:
I found a fix by removing all the relative imports from cogapp, and removing the -m, i.e. not running as a module. In this instance it's not too bad because it's a small package with only a single directory. However I'm interested in how this should be done in future. There's lots of stuff written around this subject, but no clear answers!
Here's the solution I've come to.
Disclaimer: you are actually installing the package but to a different path than the standard one.
$ mkdir newhome
$ python setup.py install --home=./newhome
$ PYTHONPATH=$PWD/newhome/lib/python <COMMAND_NEEDING_THAT_PACKAGE>