I'm trying to install Cython, which I need for using another package. I have Xcode and a C compiler. I'm using a Mac (Big Sur) with python 3.9, but I have no experience with C.
I first tried using pip:
pip3 install Cython
This resulted in the message
Requirement already satisfied: Cython in /usr/local/lib/python3.9/site-packages (0.29.23)
and I was unable to import the package into my editor, Idle. Usually, every package I install goes to
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
so I tried downloading the zip file from https://github.com/cython/cython and placing it in the above site-packages directory. At the terminal, I changed to the directory cython-master and entered
python3 setup.py install
which seemed to work since a number of messages popped up on my screen, none indicating errors, and the whole thing ending with
Installed /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-
packages/Cython-3.0a7-py3.9-macosx-10.9-x86_64.egg
Processing dependencies for Cython==3.0a7
Finished processing dependencies for Cython==3.0a7
However, I'm still receiving a module not found error a my shell in Idle.
Typically happens with a wrong pip executable.
Use $ python -mpip install
Use virtualenverapper (or the standard library venv module)
Related
I've installed Pillow using the Pip command, and it says it's installed in the system. When I run my Python3 program that imports Pillow, it returns a module not found error.
Here is the error:
sudo pip3 install Pillow
This returns:
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (8.1.2)
Then after I run my Python program which uses Pillow, I get this:
ModuleNotFoundError: No module named 'pillow'
Thanks!
Maybe you are using another version of python when you run your script..
Try to run your script from the terminal and write before it (python3)
You are probably trying to run it with a different python version or in a virtual environment, you can provide controls by going into the settings of your code editor.
I've run into an odd issue where pip just won't work. I'm using the latest version of PyCharm, and I've tried both Python 3.8.10 and 3.9.6.
I've done clean installations of both, removed from PATH, reinstalled with new installer, reinstalled pip, etc.
The error code I run into appears no matter what library I am trying to download. I've tried PyAudio, PyGame, OpenCV-Python and others.
Pip was working fine a couple days ago, and no changes have been made to any files in that time.
Attempting to run pip install --upgrade pip does not have an effect.
I've been running off virtual enviroments with setuptools 40.8.0 and pip 21.1.3 installed.
The full error for installing PyAudio can be seen here: https://pastebin.com/iQmZwsRv
PyGame error: https://pastebin.com/WEF8uM2d
OpenCV-Python Error: https://pastebin.com/LuZq99Cu
Py- audio - it's not compatible with your Py charm I suppose due to the latest install updates, try to install it on the main environment. Also, try to downgrade your version of python as many dependencies are not compatible with your version of python as stated by error[it is not compatible with this Python]
Open Cv - Fails to build the wheel package as it is attributed also in error [CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.]
May I know what build tool are you using?
I've been trying to install IMGAUG package for an ML project. But the installation gets stuck when it tries to install scikit-image
My input: pip install scikit-image
output:
Collecting imgaug
Using cached
https://files.pythonhosted.org/...
Requirement already satisfied: scipy in
c:\users\*<username>*\appdata\local\programs\python\python37\lib\site-
packages (from imgaug) (1.1.0)
Collecting scikit-image>=0.11.0 (from imgaug)
Using cached https://files.pythonhosted.org/packages/...
Complete output from command python setup.py egg_info:
----------------------------------------
Command "python setup.py egg_info" failed with error code 3221225477 in
C:\Users\<name>~1.<name2>\AppData\Local\Temp\pip-install-qmdp6ysz\scikit-image\
Note: I've already tried installing other versions of it, upgrading setuptools and pip. Error persists.
PS: Now it's showing up on everything I try to install.
(Scroll down to a horizontal line to skip explanation and go straight to the suggested solution if you wish)
3221225477 is 0xC0000005 which is NTSTATUS STATUS_ACCESS_VIOLATION; the corresponsing error message is The instruction at 0x%08lx referenced memory at 0x%08lx. The memory could not be %s..
In Windows, a process usually quits with this exit code if it tries to access an invalid memory address and Windows terminates it as a result. If you install Visual Studio, you'll be able to pinpoint the exact module at fault as shown on the link.
Now, this error means a bug in or an incompatibility between some of your installed extension modules (or in Python engine itself, but this is very unlikely in comparison).
The easiest way to fix is to clean up any problems with the involved modules' installation and (if that isn't enough) update them to the latest versions, hoping that whatever is causing that is fixed in them.
In particular, scipy in c:\users\*<username>*\appdata\local\programs\python\python37\lib\site-packages looks suspicious: you aren't using --user in your pip command
which suggests that your didn't pay attention to this flag when using pip before (it's official that it CAN lead to version conflicts), and some of your installed packages are installed both into %ProgramFiles%\Python37\Lib\site-packages and %APPDATA%\Python\Python37\ib\site-packages, with different versions in these two locations.
I hereby suggest you to:
decide where you want your 3rd-party modules to be
%ProgramFiles% is system-wide and requires elevation to manage, %APPDATA% is per-user and doesn't require elevation
Unless you don't have administrative rights at your machine (you do, judging by the command you gave) or have special needs, keep everything in the system-wide location for simplicity
uninstall all the modules in the other location (pip uninstall <name(s)> with or without --user)
reinstall them to the desired location, updating existing versions (-U pip flag)
if that wasn't enough to solve the problem (very unlikely), update all packages to the latest versions
This happened to me also. However I resolved it by uninstalling the package (pip uninstall ), then installing it using conda rather than pip (conda install ).
Hi I am new to Python I want to use an already developed tool/code and I have a problem with the modules used.
I installed Spider with Anaconda version of Python
I am trying to run below code,
https://code.google.com/p/quantandfinancial/source/browse/trunk/example_black_litterman.py
if I understood the code correctly it is referencing the below custom module https://code.google.com/p/quantandfinancial/source/browse/trunk/structures/quote.py?r=25
I stored the two parts of the code in C:\Users\Michal\Documents\Python Scripts and Python is installed in C:\Anaconda3, when I run the code I get an error
File "C:/Users/Michal/Documents/Python Scripts/Black-Litterman.py", line 4, in <module>
from structures.quote import QuoteSeries
ImportError: No module named 'structures'
Please help how can I get this code running?
pip install structures worked for me from normal windows cmd
C:\Users\user>pip install structures
You are using pip version 7.0.3, however version 7.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
> Collecting structures
> Downloading structures-2.0.2.tar.bz2
> Installing collected packages: structures
> Running setup.py install for structures
> Successfully installed structures-2.0.2
You need to do this:
pip install structures
Best idea is probably to first make a conda environment, then you can manage all the packages you need in there.
I have 64-bit python 3.4 installed, which comes with pip. I wanted to install pygame, and I know that the 32 bit version that they have on their site wouldn't work with my version of python. So I downloaded the 64-bit python 3.4 pygame package from here (pygame‑1.9.2a0‑cp34‑none‑win_amd64.whl). I renamed the package to pygame.whl and tried to use pip on the command line to install it, but it gave me this error;
Collecting pygame
Could not find a version that satisfies the requirement pygame (from versions:
)
Some externally hosted files were ignored as access to them may be unreliable
(use --allow-external pygame to allow).
No matching distribution found for pygame
So I tried using the --allow-external option, but it gave me a different error and asked me to provide a requirements file. I looked around, and found that I might need to try using the --pre option, but it gave me the exact same error as above regardless. How can I install the package?
The most likely reason you failed to install the .whl package is that you typed
pip install pygame
at the command prompt, instead of switching to the directory where you stored your renamed pygame.whl and running
pip install pygame.whl
pip requires that you give the full name of the file being installed.
The error message you got indicates that you ran the first command, and pip was looking in PyPI for pygame (which isn't there). The --allow-external command would have allowed you to specify a remote location where a source file or .whl file could be found.
In the future, I'd recommand not renaming the files downloaded from the (quite excellent) site you linked to, so that when you try to install them you're sure you're running the right command. Remember, you can always use Tab to complete file names on the command line.