How do I cache 'pip install' packages on CircleCI? - circleci

Is there a way to do this?
For example, I currently always install a specific version of docker-compose in the circle.yml file but I'd like this to be installed already via cache:
- sudo -H pip install -U docker-compose==1.3.3
I tried adding the following to the circle.yml but it doesn't work (nothing related to docker-compose was saved in the .cache/pip dir after the install):
cache_directories:
- /home/ubuntu/.cache/pip

Thanks to the help from Alexey (from Circle), got the solution:
Use a requirements.txt to install pip dependencies, i.e.:
docker-compose == 1.3.3
Modify the circle.yml file to add python as a dependency and do the pip install:
machine:
python:
version: 2.7.6
dependencies:
pre:
- pip install -r requirements.txt

Related

Error when installing python packages in dockerfile (qt5, pyqt5)

I am trying to install some packages into my docker environment so I can use them inside a container. But when I am running my Dockerfile I am getting the following error:
ERROR: Could not find a version that satisfies the requirement qt5 (from versions: none)
ERROR: No matching distribution found for qt5
Can someone please help me with this problem?
My Dockerfile:
FROM python:latest
WORKDIR /usr/src/app
RUN python3 -m pip install --upgrade pip
RUN pip3 install qt5
RUN pip3 install pyqt5
COPY ./server.py /app/
COPY ./hinto.py /app/
Note: I already have those packages successfully running on my host machine (Macbook m1)
From
https://pypi.org/project/PyQt5/
The GPL version of PyQt5 can be installed from PyPI:
Install it using:
pip3 install PyQt5

Pipenv cannot create bin folder Ubuntu 22.04 LTS

I'm trying to setup Pipenv on Ubuntu 22.04 LTS and I used:
sudo apt install pipenv
but I get an error:
FileNotFoundError: [Errno 2] No such file or directory: '/home/foo/.local/share/virtualenvs/hello-JDpq8NmY/bin/python'
I tried to update pip with:
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
Still no use.
I tried the solution suggested here and nothing changed.
The environment is there but the bin folder is missing.
I had the same problem. Remove pipenv from apt package manager and install pipenv with
pip install pipenv
After this you must set your PATH Variable to the pip dictionary.
A possible problem is related to pipenv not finding the python executable.
If this is your case is it possible to specify the path
pipenv install --python=/usr/bin/python3.10
Replace the path with desired python version
source

pipenv shell failed creating virtual environment

I am trying to create a virtual environment with the following command:
pipenv --three
But it doesn't work as the image shows:
What should I do?
I don't have virtual environment(s), like venv or virtualenv.
I had a similar problem and solved it in the following way
Uninstall PIP and pipenv, reinstall the version of python3. If not work, reinstall Python 3.7
sudo apt remove pip
sudo apt remove pipenv
sudo apt install python3-venv python3-pip
pip3 install pipenv
pipenv shell
Installing pip/setuptools/wheel with Linux Package Managers

ImportError: No module named packaging.version

When I tried installing Flask I got this error:
ImportError: No module named packaging.version
To fix this, I had to do:
pip install setuptools
If your Python runs on Ubuntu, try to do this:
cd /usr/local/lib/python2.7/dist-packages
mv pkg_resources/ pkg_resources_bak/
I'm not sure what package installed the "pkg_resources", it will make pip always show error.
Try this
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
As an Ubuntu 14.04 user, upgrading pip to version 9.0.1 fixed this problem for me.
Upgrading pip normally
Download get-pip.py script
Run: python get-pip.py
Upgrading/installing pip behind a corporate firewall
Download get-pip.py script, along with pip, wheel, and setuptools from pypi
Place all files in the /tmp directory
Run the following command to install pip: sudo -H python /tmp/get-pip.py --no-index --find-links=/tmp pip
In case anyone stumbles upon this problem, my solution was to change the packaging version from 22.0 to 21.3.

pip cannot install websocket-server python packge

I am inside my docker container, which is running centos6.6.1, and cannot seem to install the python package websocket-server.
pip install websocket-server
Could not find a version that satisfies the requirement websocket-server (from versions: )
I managed to get around this issue with the following command:
pip install git+http://github.com/Pithikos/python-websocket-server
but I don't like having to clone the repo in order to install the package. Any ideas how I can avoid this work around and get the first pip install to work?
I have the same problem with python package influxdb!
First what You need to do inside docker is upgrade pip and setuptools packages:
pip install -U setuptools pip
Do it inside virtualenv (if You use it).

Resources