I'm trying to get some python code running on an EC2 server based on Amazon Linux. The code works fine on my local machine running ubuntu.
One of the dependencies is the SimpleITK module. I install it with
easy_install -U SimpleITK
And it installs successfully, I can import the module in the REPL. However, none of its functions are accessible, I get
AttributeError: 'module' object has no attribute 'ReadImage'
and similar errors for all functions I need. After some investigation, it seems easy_install has somehow messed up the setup. On my local machine, when I do help(SimpleITK) I get the full list of functions, and crucially, the FILE is listed as :
/usr/local/lib/python2.7/.../SimpleITK/SimpleITK.py
But on the EC2 server, it is listed as
/usr/local/lib/python2.7/.../SimpleITK
I believe this is reason for the problems I am getting - on the server, python doesn't know that the 'file' it's talking about is actually a directory, and the actual source for the module is inside that directory.
I've tried reinstalling the module, upgrading setuptools, but the error remains. I tried installing with pip, but pip can't even find the module.
I had the same issue and it was a problem of having several pythons; in my case anaconda and the one that comes with ubuntu. To solve it, I deleted the simpleitk package in each of them (pip uninstall simpleitk) using the pip of each python distribution. Then I installed it again using pip install with the anaconda executable.
Related
I'm trying to run a Python module for a school project and I am getting this error ModuleNotFoundError: No module named 'win32crypt' at line import win32crypt.
I've search the website for solution and encountered a post that states pywin32 is required. So I installed it with pip. I also tried installing pypiwin32. None of these installs worked. Now I've tried Dependency Walker to see if there are any dependencies missing and I see at least 100 DLLs that are. How can I fix the issue?
win32cryrpt is a part of the Windows Extensions for Python or pywin32. It is a wrapper around the Windows crypto API. It doesn't make sense to try and install it without pywin32 and if your install of that has failed then that is the problem you have to solve.
Please try pip install pypiwin32 again, being sure to execute it in the correct folder, which is the Scripts subfolder of the Python environment you want to install it in. You may have more than one Python installation without realizing it, and if you run pip from outside that folder, you may get a different instance of pip. The standard location for Python installations is C:\Program Files\Python3x. If the pip install doesn't complete as expected then edit your question to include the messages from the failed install. Did not work isn't enough to go on.
I try a python code for signature recognition, and there is an import ffnet module (from ffnet import mlgraph, ffnet), but I got an error when I run it.
The error is:
ModuleNotFoundError: No module named 'ffnet'
I have install the module, but still got that error
Help me to fix this :)
You need to make sure that it is correctly installed. The error message means directly "You haven't installed it properly".
Depending on what Python version you're using, you should have a package manager called pip that takes charge of installing and uninstalling modules. Try:
pip2 install ffnet if you have Python 2.
pip3 install ffnet if you have Python 3.
Alternatively, you may have installed Python using Anaconda. In this case, use conda install ffnet. In all cases, run the proposed commands in a terminal.
However, it would be quite useful to have more details about your problem (what OS do you have, how and where did you install Python, what version do you have).
There is great chance that the pip (i suppose you use pip for installation, the idea is identical) you use to install ffnet is not correspond to the python you are using. Maybe a virtualenv is running, or you using python 2 but ffnet is installed with pip3
My suggestion:
- Run which pip. Run which python. Compare the results if anything seem wrong (python2 pip3 for example). Try to run python2 and pip2 instead of python and pip
- If the above suggestion doesn't work, you should try to recheck your PATH: Find the pip correspond to your current python (usually within the same dir) and export PATH=/path/to/THAT/pip/:$PATH
- If the problem still persist, I suppose your pip file's first line (for specifying its corresponding python path) has been modified without your awareness. You will have to manually edit it to something like #!/usr/bin/python3
Hope this help!
I've been following sentdex's python beginner series. I was doing well enough until I had to path python so I could use pip. I did that, and tried installing a few whl files, cx_Freeze and PIL.
It said everything was installed correctly and they're in libs/site packages but whenever I try to draw from them I get an error saying
ModuleNotFoundError: No module named 'cx_Freeze' (or PIL or whatnot).
Am I getting the wrong version?
EDIT: So I thought the problem was that the python shell was in a different location than the rest of my python install, which is not the case, I just only saw part of the path. I re-ran the script in the command prompt version of python.exe and I got no errors. What the hell is going on
you probably run a different python or pip then the one you expect. It happens with me often. To avoid such an issue use:
python -m pip install Pillow
python -c "from PIL import Image; print(Image)"
by calling the same python executable you avoid problems using a pip that belongs to a different python install.
You can also use:
python `which pip` install Pillow
I’m completely new to Python and I want to install the package py-webrtcvad in Windows 7, but I'm stuck at the error ImportError: No module named 'pip.utils.setuptools_build'. There is an answer to this problem in stackoverflow which seems to solve the problem for others, but it doesn't work for me.
Here’s a summary of what I’ve done and tried so far:
Installed Python 3.5 and set up the Windows path environment so
that it works from any directory.
Installed pip for Python.
Tried to install the package with python -m pip install webrtcvad,
but it failed, returning the error Unable to find vcvarsall.bat.
I found a blog that deals with the vcvarsall.bat
problem: blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat. Following the directions of that blog:
First I just installed Visual C++ Build Tools 2015 and tried installing the package straight away (without updating setuptools), but I received a lot of error messages (which I didn’t write down).
I tried reinstalling setuptools, which I did following the directions in https://pypi.python.org/pypi/setuptools: I removed the version of setuptools that came with my Python installation (v20), and installed the latest version (v30). This time I got a different error message when trying to install py-webrtcvad: ImportError: No module named 'pip.utils.setuptools_build'.
Asked for assistance in the Python official chat. They made three
suggestions:
Updating pip with python -m pip install --upgrade pip. Didn’t
work. Again, the error ImportError: No module named 'pip.utils.setuptools_build'.
Reinstalling Visual C++ Build Tools 2015. No difference, same error
again.
Reinstalling Python itself. The Python installer offers three
choices: Repair, modify and uninstall.
Repair: Didn’t work. Same error.
Modify: Doesn’t look like it offers useful modifications for this.
Uninstall: Uninstalled and reinstalled. Still the same error.
I’m out of ideas. Can you help me?
Note: I imagine this should be doable in Windows 7 with Python 3.5. However, if it isn't I'm open to trying anything different. For example, installing a different version of Python would be no problem at all. I could also try installing Linux if that will solve the problem.
There was a bug in version 2.0.8 of webrtcvad that caused it to use the wrong flags when compiling for Windows: it was using -DWEBRTC_POSIX instead of -DWIN32. This might have been the source of the "lot of error messages" you got during one of your early attempts.
The fixed version has been pushed to pypi as version 2.0.9. I've confirmed that pip install webrtcvad works correctly on Windows 10. I'm using a pretty fresh install of Python, so I would try it first without reinstalling setuptools.
Recently, I installed trac on my local machine for testing purposes.
To get it running, I needed to install several support modules using easy_install.
Now, I'm going to take my local installation and move it to a real server that has no Python installed yet.
While moving the trac installation itself seems trivial (http://trac.edgewall.org/wiki/TracBackup, https://serverfault.com/questions/6147/how-do-i-backup-my-trac-instalations), actually getting it running needs the modules that I installed with easy_install.
Is there a convenient way (such as for example PPM for Perl) that I could use in order to get the same modules installed on the server that I have on my local machine?
If you don't use pip, only use easy_install, try https://pypi.python.org/pypi/yolk
Install Pip, and then
pip freeze
You can also use help function in python to get the list of modules installed. Get into python prompt and type the following command.
help('modules')