pipx fails for poetry on Ubuntu 20.04? - pipx

$ pipx install poetry
Could not find package poetry. Is the name correct?
$ python --version
Python 3.8.10
is there a way to work around this? this works on 22.04 perfectly.. but I want to use python 3.8.x with pipx so backed off to 20.04...

Related

Cannot install python wheel file in conda without sudo

I'm trying to build PyTorch from a .whl file on a jetson nano.
I am able to build and install the file but only while using sudo, attempting to pip install the file without sudo results in this error:
ERROR: torch-1.10.0a0+git36449ea-cp36-cp36m-linux_aarch64.whl is not a supported wheel on this platform.
This is strange as with admin I have no issues installing this file, but I can then only use the library by using the sudo command before going into or running with the python command.
I should note that this is in a conda environment, but even in the base conda environment this issue still occurs.
It seems like I can also install the package by using conda deactivate to deactivate conda.
I am using Python 3.7 in the conda environment and Python 3.6 outside.
I am using Python 3.7 in the conda environment and Python 3.6 outside.
This is the issue. You have a cp36 whl file, so python 3.6. I am suspecting that when you run sudo pip, your systems pip is invoked, whereas when you run pip, then pip from your conda env is used, and cannot install a python 3.6 whl to a python 3.7 env.
Either you need to get the cp37 whl or create a conda env that has python 3.6 installed

How to install pip in RHEL6 to use "virualenv" with python 2.6.6

Background:
Robot scripts are developed on Python 3.* and they can only be executed in python3.
Problem:
We have RHEL6 machine which uses python 2.6.6 which cannot be updated.
Prepared Solution :
We are trying to enable the use of virtualenv in a RHEL6 machine so that we can execute the robot scripts in virtual environment with a different python version, We are facing issues with installation of pip in RHEL6 machine.
You need pip/setuptools from here: https://bootstrap.pypa.io/2.6/ and you need a very old version of virtualenv.
Download get-pip.py and run
sudo python2.6 get-pip.py
virtualenv 15.2.0 seems to be the last version that supports Python 2.6. Try
python2.6 -m pip install 'virtualenv==15.2.0'
or
python2.6 -m pip install 'virtualenv<16.0'
with you fresh pip.

Py.test command not found, but library is installed

There are already two posts on stack overflow on this topic; however, none of them have resolved or addressed my specific situation.
I have installed pytest via pip install pytest. I am able to import the library in Python as well.
The problem is that when I try to use the py.test command in Terminal, I get py.test: command not found.
Does anyone have any insight as to why I am not able to use the command in the terminal?
EDIT: It even shows up as an installed package:
$ pip list
cycler (0.9.0)
matplotlib (1.5.1)
numpy (1.10.1)
pip (8.1.0)
py (1.4.31)
pyparsing (2.0.7)
pytest (2.9.0)
python-dateutil (2.4.2)
pytz (2015.7)
scipy (0.17.0)
setuptools (7.0)
six (1.10.0)
tensorflow (0.5.0)
vboxapi (1.0)
wheel (0.26.0)
using python -m pytest will work for you.
Or if you using virtual environment and installed pytest on virtualenv you should then run py.test alongside your virtual environment.
Check this website can be useful:http://pythontesting.net/framework/pytest/pytest-introduction/
I already had the latest version of pytest on macOS with Homebrew-installed Python 2.7 and this fixed it:
pip uninstall pytest
pip install pytest
Are you on a mac with homebrew by any chance?
I had the same issue and it basically came down to permissions/conflict with the mac os base installed python. pip install would not install or link stuff into /usr/local/bin (it happened with both virtualenv and pytest).
I uninstalled python 2.7 completely with homebrew (brew uninstall python).
Next, I reinstalled python with homebrew to fix pip (it was not a symlink in /usr/local/bin/pip where it should have been linked to Cellar) -- brew install python
Then I uninstalled pip with sudo -- sudo python -m pip uninstall pip to remove the pip owned by root
Now I uninstalled and reinstalled python with homebrew again to reinstall pip with the correct permissions brew uninstall python && brew install python
Next I fixed the python symlinks brew link python
Finally, pip install pytest worked! (and so did pip install virtualenv)
I found the information in the chosen answer from this post very helpful:
https://superuser.com/questions/915810/pip-not-working-on-hombrew-python-2-7-install.
If you're not on a mac, sorry for the noise...
I may be late, but while exploring this I noticed that this can be because the Scripts folder for python is not present in the PATH.
For me this is my scripts folder:
C:\Python38\Scripts\
If the path is a problem then running pip install pytest should actually you give you the warning with the path it was added to.
This should be present in the path. If on windows, edit the environment variables and this location to the PATH.
For me the path was incorrect because of an improper installation of python
I had the same issue. I had pytest v2.8.3 installed and the binary was on my path but under the name py.test. Upgrading to v3.0.3 added the regular pytest executable to the path.
I had the same problem. I have changed the Python installed folder permission to full access. And then uninstalled the pytest and installed again.
pip uninstall pytest
In my case, I had a similar issue in ubuntu 20.04. The below solution worked for me.
Cause: Shell remembers the previous version or previously used Path, hence we need to force the shell to 'forget' the old location - with -r
hash -r pytest
Then execute the tests it should work fine.
For MAC users:
Download python universal installer for mac:
https://www.python.org/ftp/python/3.10.5/python-3.10.5-macos11.pkg
Then try to install pytest module in terminal using this command:
pip install pytest
Hope this will fix the issue. Thanks!
use the command, pip install -U pytest and install it in your cmd prompt, it will solve the issueenter image description here
I used macbook air m2, and the way I deal with this problem is:
Command in terminal in macbook:
which pytest
/opt/anaconda3/bin/pytest -> my terminal shows this
Then you got the path of pytest, in the "Command", before "pytest", add its path and following with the path of python file you wanna test.
/opt/anaconda3/bin/pytest /Users/cindyng/Desktop/Testing.py
Done, and if you cannot find the path of python in macbook, "which python" also helps, and you can put it in "Home" and "Custom Python Builder".
Hope that helps, good luck!
I Fixed this issue via below steps.
1.First uninstall existing pytest.
2.Check python version.
3.then verify pytest version is supported with python version or not via github issue tracker.
4. via sudo install pytest
sudo pip install pytest
5. verify pytest version and insatlled correctly or not.
pip list
pytest --version
6.run any test using pytest test_abc.py
I encounter the same problem, python -m pytest works for me.

I don't know how to update my Python version to 3.4?

I'm on OSX, and I installed IDLE for Python 3.4. However, in Terminal my python -V and pip --version are both Python 2.7.
How do I fix this? I really have no idea how any of this works, so please bear with my lack of knowledge.
When you install Python3, you can use python3 to run python programs(or use a shebang). Python 3 also install pip. If you find your Python3 installed version of pip try to alias the pip command to the newer pip. Check this out for more info:
How to install pip for Python 3 on Mac OS X?
Try python3 or python3.4. It should print out the right version if correctly installed.
Python 3.4 already has pip with it. You can use python3 -m pip to access pip. Or python3 -m ensurepip to make sure that it's correctly installed.
I have found that making the 'python' alias replace the default version of python that the system comes with is a bad idea.
When you install a new version of python (3.4 for instance),
these two new commands are installed, specifically for the version you installed:
pip3.4
python3.4
If you're using an IDE that wants you to indicate which python version you are using the IDE will let you navigate to it in the Library folder
pip will still be for python2.7 after you download some other python version, as I think that's the current version osx comes installed with

I have installed virtualenv 1.9 which includes pip, but cannot install nltk

I have installed virtualenv 1.9 which includes pip, but cannot install nltk on my Mac. First it does not recognize pip as a command. Second how do I install nltk?
You should be able to run the following command to setup the virtual environment:
$ virtualenv venv
New python executable in venv/bin/python
Installing setuptools.............done.
Installing pip...............done.
Then activate the virtual environment using:
$ source venv/bin/activate
Then install nltk:
(venv)$ pip install nltk
When you are done with the virtual environment run:
$ deactivate
You may want to try installing Python using Homebrew rather than using the Python version included with the OS. With 'brew' you will not need to use virtualenv (unless you want to) because brew installs packages to /usr/local owned by you. So you can simply run 'pip install '.
Follow the installation instructions here for Homebrew. Then run:
$ brew install python
$ pip install nltk
You can install virtualenv as well if you want it.
$ pip install virtualenv

Resources