I'm running OpenSuse 42.3, and I have installed numpy 1.13.1 using pip install numpy.
I run the command:
f2py -c PDFF.f -m PDFF
I get the error:
error: file '/usr/lib64/python2.7/site-packages/numpy/f2py/src/fortranobject.c' does not exist
If I do an ls on that directory, there are no files in the /src directory of f2py. I had no issues when I was running on OpenSuse 13.2. We recently upgraded to 42.3.
Is this a known issue?
The version of pip that I was using is linked to Python3.4 by default. So all modules that I install using pip install' are added to the Python3.4 system directory. I did a zypper install python-pip, which added the pip module to the Python2.7 build on the system. I then ran sudo python -m pip install --upgrade numpy, and now the appropriate files have been added to the /src directory in the f2py utility for the Python2.7 build.
Related
I'm learning network automation using python. I'm unable to install Napalm-fortios module in my pycharm because of the error as below.
Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at 'C:\Users\user\PycharmProjects\DUKE\venv\Scripts\python.exe'.
Collecting napalm-fortios
Using cached napalm-fortios-0.4.1.tar.gz (7.0 kB)
ERROR: Command errored out with exit status 1:
command: 'C:\Users\user\PycharmProjects\DUKE\venv\Scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pycharm-packaging\\napalm-fortios\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pycharm-packaging\\napalm-fortios\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\user\AppData\Local\Temp\pycharm-packaging\napalm-fortios\pip-egg-info'
cwd: C:\Users\user\AppData\Local\Temp\pycharm-packaging\napalm-fortios\
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\user\AppData\Local\Temp\pycharm-packaging\napalm-fortios\setup.py", line 6, in <module>
from pip.req import parse_requirements
ModuleNotFoundError: No module named 'pip.req'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Update PIP using below command,
pip install --upgrade pip
Command to install napalm-fortios package,
pip install napalm-fortios
You can try the below solution steps;
The Python "ModuleNotFoundError: No module named 'pip'" occurs when pip is not installed in our Python environment. To solve the error, install the module by running the python -m ensurepip --upgrade command on Linux or MacOS or py -m ensurepip --upgrade on Windows.
Open your terminal and run the following command to install pip.
On Linux or MacOS
python -m ensurepip --upgrade
using python 3
python3 -m ensurepip --upgrade
On Windows
py -m ensurepip --upgrade
The ensurepip package enables us to bootstrap the pip installer into an existing Python installation or virtual environment.
If the PATH for pip is not set up on your machine, replace pip with python3 -m pip:
make sure to use your version of Python, e.g. 3.10
python3 -m pip install requests
Alternatively, you can use the official get-pip script to install pip.
Download the script from https://bootstrap.pypa.io/get-pip.py by clicking on the link, right-clicking and selecting "Save as" in your browser.
Open your terminal in the location where the get-pip.py file is downloaded and run the following command.
On Linux or MacOS
python get-pip.py
using python 3
python3 get-pip.py
On Windows
py get-pip.py
The get-pip.py script uses bootstrapping logic to install pip.
If none of the suggestions helped, try to install pip with a command that's specific to your operating system.
On Debian / Ubuntu
sudo apt update
sudo apt install python3-venv python3-pip
On MacOS
brew install python
On Fedora / CentOS
sudo dnf install python3-pip python3-wheel
Try upgrading pip by running:
on MacOS or Linux
python -m pip install --upgrade pip
for Python 3
python3 -m pip install --upgrade pip
on Windows
py -m pip install --upgrade pip
If the error persists, get your Python version and make sure you are installing the package using the correct Python version.
python --version
For example, my Python version is 3.10.4, so I would install the requests package with pip3.10 install requests.
pip3.10 install requests
if you get permissions error
sudo pip3.10 install requests
Notice that the version number corresponds to the version of Python I'm using.
If that didn't help and you're using a virtual environment, try recreating it.
deactivate
deactivate
remove the old virtual environment folder
rm -rf venv
initialize a new virtual environment
python3 -m venv venv
activate on Unix or MacOS
source venv/bin/activate
activate on Windows (cmd.exe)
venv\Scripts\activate.bat
activate on Windows (PowerShell)
venv\Scripts\Activate.ps1
install the modules in your requirements.txt file
pip install -r requirements.txt
Your virtual environment will use the version of Python that was used to create it.
This should work if your previous virtual environment didn't have pip installed for some reason.
If none of the suggestions helped on a Windows machine, try installing
pip from the directory where the pip.exe file is located.
First locate Python by running the following command using cmd:
for Windows
where python
or a specific version if you have multiple installed
where python3
Now open the Scripts folder and make sure it contains the pip.exe file.
Open your command prompt in the Scripts directory right next to the pip.exe file and run the following command.
pip install pip
py -m pip install --upgrade pip
If the error persists, I would suggest watching a quick video on how to set Python and pip in your PATH environment variable.
Ref. https://bobbyhadz.com/blog/python-no-module-named-pip
I noticed (after a lot of digging) that python3 -m pip install . does not install my package located in the current working directory, since . is on sys.path; i.e. in this case, pip seems to think that the package is already installed. However, when doing pip3 install ., the package in current working directory is in fact installed as I expected.
I'd expect python3 -m pip to behave the same as pip (PATH issues aside!), but clearly they don't in this particular case. Why?
For the record, I'm running this in a docker container with an ubuntu bionic base image and python3 installed from apt install.
I have multiple versions of python install in my linux.
python
python2.7
python2.7-config
python2-config
python2-jsonschema
python2-pbr
python3
python3.4
python3.4m
python3.6
python3.6-config
python3.6m
python3.6m-config
python3-config
python3m
python3m-config
python-argcomplete-check-easy-install-script
python-argcomplete-tcsh
python-config
python-faraday
I installed quandl package using pip. it's installed but when I run the code it says there is no module as quandl. I think its related to multiple versions of python.how can I uninstall these versions and which one i should uninstall and how can i install packages and run my code without any worry! I am a beginner so please help me.
in Linux,if you are using Global environment You should use python3.x for all command-line operations as in python3.4, python3.6 or pip3.4, pip3.6 when compiling so it installs to specified version.
for your problem to find the installed module run:
pip3.4 list pip3.6 list and pip 2.7 list and find quandl in them.
If it is not in the required version of yours, run: pip[your-version] install quandl
First, sure that pip3 is installed or install it.
ubuntu: sudo apt install python3-pip --upgrade
now, install your package with pip3 instead of pip:
pip3 install quandl
I hope it will work:)
EDITED:
with this code, you create a virtualenv and run your script with it.
pip3 install virtualenv
virtualenv -p python3.x venv //3.x will be version you want
source venv/bin/activate
pip install quandl, {and what else you want}
python script.py
for deactivating virtualenv, just run this in commandLine:
deavtivate
I try install pygobject by pip
pip install --user PyGObject
but I doesn't work:
Collecting PyGObject
Using cached pygobject-2.28.3.tar.bz2
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "C:\Users\A\AppData\Local\Temp\pip-build-phby_jwb\PyGObject\
setup.py", line 272
raise SystemExit, 'ERROR: Nothing to do, gio could not be found and is
essential.'
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\A\AppData\Local\Temp\pip-build-phby_jwb\PyGObject
My python version v3.5.0:374f501f4567,
Now I work on windows 7
For windows
Go to http://www.msys2.org/ and download the x86_64 installer
Follow the instructions on the page for setting up the basic environment
Run C:\msys64\mingw32.exe - a terminal window should pop up
Execute pacman -Suy
Execute pacman -S mingw-w64-i686-gtk3 mingw-w64-i686-python3-gobject
To test that GTK 3 is working you can run gtk3-demo
Copy the hello.py script you created to C:\msys64\home\<username>
In the mingw32 terminal execute python3 hello.py - a window should appear.
For ubuntu / Debian
Installing the system provided PyGObject:
Open a terminal
Execute sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-3.0
Change the directory to where your hello.py script can be found (e.g. cd Desktop)
Run python3 hello.py
Installing from PyPI with pip:
Open a terminal and enter your virtual environment
Execute
sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0
Execute pip3 install pycairo to build and install Pycairo
Execute pip3 install PyGObject to build and install PyGObject
Change the working directory to where your hello.py script can be found
Run python3 hello.py
You can read more here
Since February 2017, you can install pygobject directly through pip: pip install pygobject. It requires some packages to be installed though.
Before that, it took a while, but it was possible to install pygobject with pip, since this commit.
pygobject wasn't on pypi though, so you had to specify the git or tarball URL:
git+https://git.gnome.org/browse/pygobject
https://download.gnome.org/sources/pygobject/3.22/pygobject-3.22.0.tar.xz
The latter only works with pygobject 3.22+, which should have happenned around mid-september 2016. (3.21.1 should be the first pip-installable development release)
Upstream PyGObject just does not support this. See the PyGObject win32 project or the MSYS2 project to get it easily.
I'll just add what I've been using to make this work seamlessly in various projects.
It uses GNU Make, by providing a venv target one can use as a dependency to other targets to ensure a properly created virtual environment.
The venv target itself depends on a, albeit configurable, requirements.txt; the standard python requirements file.
A target test is include as an example of how one would use this.
The trick is to create a symlink to the installed system package. ln -s ${DIST_PACKAGES}/gi ${VENV_NAME}/lib/python${PYTHON_VER}/site-packages/gi, where $DIST_PACKAGE is the location of the python installed libraries on your system.
For those not familiar with make. Create a file named Makefile in the root of your project, copy the contents bellow, and issue the command make configure && make venv.
Makefile
# directory to store virtual environment
VENV_NAME=venv
# python runtime version
PYTHON_VER=3.6
# python executble
PYTHON=${VENV_NAME}/bin/python${PYTHON_VER}
# python local libraries location
DIST_PACKAGES=/usr/lib/python3/dist-packages
# pip requirements file
REQUIREMENTS=requirements.txt
configure: ## Install required debian packages.
sudo apt-get -y install python${PYTHON_VER} python3-pip libgirepository1.0-dev
python3 -m pip install virtualenv pygobject
make venv
venv: ## Recreates the virtual environment if needed.
venv: $(VENV_NAME)/bin/activate
$(VENV_NAME)/bin/activate: ${REQUIREMENTS}
test -d $(VENV_NAME) || virtualenv -p python${PYTHON_VER} $(VENV_NAME)
${PYTHON} -m pip install -U pip
${PYTHON} -m pip install -r ${REQUIREMENTS}
ln -s ${DIST_PACKAGES}/gi ${VENV_NAME}/lib/python${PYTHON_VER}/site-packages/gi
touch $#
test: ## Runs the test suite.
test: venv
$(PYTHON) -m pytest tests
I am working on Ubuntu 10.10 and I have installed pip using the following command
apt-get install python-pip
However when I try installing any package using pip I get the following error
ImportError: No module named pip.log
What has possibly gone wrong here?hon
I have the same problem on debian squeezy(6.0) which default installation is python 2.6. To reproduce the problem:
Upgrade python to 2.7 from building the source code and installed it in /opt/python.
wget bootstrap.pypa.io/get-pip.py and run get-pip.py. The installtion should be successful.
run pip and the errors occur. ImportError: No module named pip.log.
The steps to solve the problem:
ls -l /usr/bin/pip find the old pip installation location.
rm -rf pip remove the old pip installation.
reinstall the pip with get-pip.py
relink the /usr/bin/pip to the new pip installation location which in my computer is ln -s /opt/python/lib/python2.7/site-packages/pip/__init__.py pip