Cygwin terminal is only recognizing `pip3 install` rather than `pip2 install` - pip

I need to install the python future module to compile a code using ./waf command, and I'm doing this using the Cygwin 64 terminal. However, due to incompatibility issues I keep getting future module not found though it is already installed. I'm trying to re-install the module using pip2 install command, and the following error occurred:
Gover#LAPTOP-OV3886CH /cygdrive/d/ardupilot
$ pip2 install future
-bash: pip2: command not found
However, I can install the future module using pip3 install , but this is still not compatible with the ./waf command. Why is pip2 install not working?

Install python27-pip and python27packages
see package contents on
https://cygwin.com/packages/x86_64/python27-pip/python27-pip-20.3.3-2

Related

ERROR:Failed building wheel for h5pyFailed to build h5pyERROR:Could not build wheels for h5py,which is required toinstall pyproject.toml-basedprojects

I'm getting this error when I'm running the following command to install tensorflow.
python3 -m pip install tensorflow-macos
ERROR: Failed building wheel for h5py
Failed to build h5py
ERROR: Could not build wheels for h5py, which is required to install pyproject.toml-based projects
I tired to install this wheel manually, from the official link (https://pypi.org/project/h5py/#files), it got installed properly but I'm still getting the same error.
I'm facing the above issue in Mac Book M1 chip.
The official doc to use brew install.
$ brew install hdf5
If the above command gives you rosetta 2 issue, then run:-
arch -arm64 brew install hdf5
Once, the h5py installation is done, run following 2 commands:-
$ export HDF5_DIR=/opt/homebrew/Cellar/hdf5/1.12.0_4 OR export HDF5_DIR=/opt/homebrew/opt/hdf5 (if hdf5 is installed in the "/opt/homebrew/opt/hdf5" location, you have to check it out first)
$ pip install --no-binary=h5py h5py
Note:- in the first command "1.12.0_4" is the version of hdfc installed in my system, you have to change it according to yours.
If you are getting the aforementioned error implies you must be using poetry.
Finally run:-
poetry install
We are running the above command, In case poetry wants to update anything.
Once we run poetry install, it might update existing libraries or download new libraries.
So we have to update poetry.lock file as well.
poetry lock
After installing hdf5 try "export HDF5_DIR=/opt/homebrew/opt/hdf5"
Ref: https://github.com/h5py/h5py/issues/2035#issuecomment-1028226141
This works for me:
Install brew (https://brew.sh/)
brew install hdf5
export HDF5_DIR=$(brew --prefix hdf5) (as #sgt pepper said)
pip install --no-binary=h5py h5py

pip trying to install using old version of python

so I just uninstalled a wrong version of python 3.8 and downloaded python 3.7.4
Now I'm trying to install packages using the command pip install X and get the following error.
C:\Users\User>pip install cv2
Fatal error in launcher: Unable to create process using '"c:\users\user\appdata\local\programs\python\python38-32\python.exe" "C:\Users\User\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe" install cv2': The system cannot find the file specified.
clearly it is still trying to use the old version of python 3.8 even though I have uninstalled it and reinstalled pip several times.
Any idea on why its trying to look for this old path? and how can I change the default path it is using?
(btw this is just a matter of convenience because as of the moment if I use the command python -m pip install X it does seem to work)
try command python -m pip install --upgrade pip
Delete and clear environment config and install again...

Basemap install on mac without fink (I tried everything I can google)

I am a Python Noob. (Using Mac OS 10.12 & Python 3.7)
I'm trying to use mpl_toolkits.basemap
to execute the code
from mpl_toolkits.basemap import Basemap
I googled the way to get matplotlib and successfully installed it.
However, while it's possible to run "from mpl_toolkits.basemap import Basemap" in terminal on mac,
it fails to be loaded if I run the command within IDLE.
Then, I googled to figure out the issue and got the hint that
it could be resolved if I install Basemap properly.
To install Basemap, I think I need to go with "FINK".
However, Fink is only available up to 10.5 OS while mine is 10.12.
And FINK website says do not update OS before upgrading FINK.
However, it's too late for me.
Cause I updated my OS longtime ago and recently I started to learn Python Using Mac.
So I guess, if there is a way to install Basemap not using apt-get,
(the codes below is from "Python basemap module impossible to import")
sudo apt-get install libgeos-3.5.0
sudo apt-get install libgeos-dev
sudo pip install https://github.com/matplotlib/basemap/archive/master.zip
I think my issue could be cleared.
Since I'm really really noob, I'm not sure this is the reason for my failing in "from mpl_toolkits.basemap import Basemap".
What I tried so far is
1) brew install basemap
with the error of
Error: No available formula with the name "basemap"
==> Searching for a previously deleted formula (in the last month)... Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
2) pip install basemap
with the error of
Requirement already satisfied
3) sudo pip install https://github.com/matplotlib/basemap/archive/master.zip
with the error of
Command "python setup.py egg_info" failed with error code 1 in
/private/tmp/pip-install-lux494o4/pyproj/
4) conda install basemap
with the following message of
All requested packages already installed.
5) conda install -c conda-forge basemap
with the following message
Preparing transaction: done Verifying transaction: done Executing
transaction: done
Can anyone help to install basemap properly so that I could run
"from mpl_toolkits.basemap import Basemap"
in my IDLe?
My IDLE Sheel keeps saying
Traceback (most recent call last): File "", line 1, in
from mpl_toolkits.basemap import Basemap ModuleNotFoundError: No module named 'mpl_toolkits.basemap'
while my terminal doesn't have problem with running the code.
Appreciate it in advance.
any luck? I spent the day battling this as well. I had the most success when I tried downloading an older version of basemap.
I was using python 2.7 and this worked okay sudo -H pip2 install https://github.com/matplotlib/basemap/archive/v1.1.0.tar.gz
For python 3 try replacing pip2 with pip3 or pip.
Ran into this myself today my solution:
install libgeos on mac
brew install geos
then as you suggested use pip to install mpl_tools:
pip3 install -q https://github.com/matplotlib/basemap/archive/master.zip
This also may help:
missing libgeos_c.so on OSX
Firstly, I suggest you to set Anaconda up. Then follow below steps;
Create a new environment in anaconda.
Install Jupyter Notebook and launch it. If it works, turn it off.
Change your anaconda environment in your terminal.
Try installation commands below;
conda install ...
conda install forge ...
pip install ...

Error installing PyGObject, 'glib-object.h' file not found

I am trying to install pygobject for python 2.7 in pycharm for the purpose of using gstreamer. However I am having problems installing it. While in the virtual environment, if I use
pip install pygobject
Then the build fails and gives me this error
gi/gimodule.c:25:10: fatal error: 'glib-object.h' file not found
#include <glib-object.h>
^~~~~~~~~~~~~~~
1 error generated.
error: command 'cc' failed with exit status 1
full error log here
I know for a fact that glib exists on my system from searching for it with
find /usr -name glib-object.h
but for some reason the install can't find it. Do I have to link it in somehow/how do I go about doing this?
Also I know I can more successfully use this library with python3 but that caused some weird system errors that can apparently be resolved by using 2.7 so I am just exploring that at the moment.
With virtual environments it's recommended installing PyGObject with pipenv instead of pip.
Install pipenv with either MacPorts, HomeBrew or pipsi:
MacPorts
port install pipenv
HomeBrew
brew install pipenv
pipsi
curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python3 - --src=git+https://github.com/mitsuhiko/pipsi.git\#egg=pipsi
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
pipsi install pew
pipsi install pipenv
Once you've got pipenv installed then you should be able to add the package to your virtual environment:
pipenv install pygobject
↳ PyGObject : Creating A Development Environment

Could not execute command lessc' while running odoo (any version) in eclipse mac

After a thorough analysis of 'Could not execute command lessc' i've successfully ran odoo (any version) on my command line with python virtual env. Am doing this to run odoo in command line
$ . {PATH_TO_VIRTUAL_ENV}/bin/activate (Running the script in the current shell)
$ cd {PATH_TO_ODOO_SOURCE}
$ ./odoo.py -c setup.cfg
And the above runs with proper UI.
Now when trying to run the same from eclipse throws me 'Could not execute command lessc'. I did the below to run code from eclipse
Installed pydev plugin in eclipse Mars
Configured Python interpreter (Given the virtual env python path here. i.e {PATH_TO_VIRTUAL_ENV}/bin/python)
Setup odoo source
Specified the new python interpreter on the project properties -> python interpretor
Created a new Run Configuration to run the source with the custom setup file and with the new interpretor
Kindly throw me light on places where i miss. Also i've gone through links on setting up python virtual env in eclipse. They all say the same thing still this lessc dependency is somehow not linked. Please comment if you require more info to identify the error. Thanks for your help! :)
FYI am using mac.
Update
For Shikhar (based on his answer)
This problem is related to your bad configuration of Nodejs and less on system.
Use commands below to resolve this -
wget -qO- https://deb.nodesource.com/setup | sudo bash -
then
brew install node
and finally
sudo npm install -g less less-plugin-clean-css
This will resolve the lessc command issue.
try this
sudo apt-get install node-clean-css
sudo apt-get install node-less
The solution:
sudo apt-get install node-clean-css
sudo apt-get install node-less
may work for Global system installation but if you are working within a virtualenv you may try this.
If somebody had the issue inside PyCharm wich was my case and nothing else works...
I leave my solution here:
First: I tried to check if node and npm exist inside my virtualenv: node -v and npm -v, not any of them... Second: I was using virtualenv, also when I ask inside my virtualenv with: which lessc . I didn't receive any response neither, so... I keep googling and found this post: How to install lessc and nodejs in a Python virtualenv?
In any case this was what I did on my virtualenv and the problem was solved:
MYVIRTUALENV/bin/activate # switch to my Python virtualenv first
pip3.7 install nodeenv # install nodeenv nodeenv was installed, in case you are using python 2.x use pip instead pip3
nodeenv --python-virtualenv # Use current python virtualenv
npm install -g less # install lessc in the virtualenv
npm install -g less-plugin-clean-css # also install this less-plugin...
then if I check with node -v and npm -v I get a proper response...
also get good response on: which lessc
After that no more nightmare with lessc execution in pycharm

Resources