I am working on a mixed Rust/Python project being build with maturin. I am having trouble figuring out how I can specify a pre-release version that can than be installed by pip.
The start of my Cargo.toml is
[package]
version = "0.0.1-test.1"
When I do maturin build --release, it creates my_project-0.0.1_test.1-cp39-cp39-macosx_10_7_x86_64.whl. Note that 0.0.1-test.1 in the version was changed to 0.0.1_test.1 in the name of the wheel file. (The dash became an underscore.)
If I publish this to my Nexus server and try to install it in a separate project, pip gives an error:
$ pip install my_project==0.0.1_test.1
Looking in indexes: ...
ERROR: Could not find a version that satisfies the requirement my_project==0.0.1_test.1 (from versions: 0.0.1-test.1, 0.0.1.dev1)
If I try it with a dash instead of an underscore:
pip install py_mod_query_builder==0.0.1-test.1
Looking in indexes: ...
ERROR: Exception:
<stack trace>
pip._vendor.packaging.version.InvalidVersion: Invalid version: '0.0.1-test.1'
If I change the version in Cargo.toml to 0.0.1_troy.1, then Cargo fails to parse the build file:
$ maturin build --release
🍹 Building a mixed python/rust project
💥 maturin failed
Caused by: Cargo metadata failed. Do you have cargo in your PATH?
Caused by: Error during execution of `cargo metadata`: error: failed to parse manifest at `/Users/me/my-project/Cargo.toml`
Caused by:
unexpected character '_' after patch version number for key `package.version`
I did have some success with pip install path/to/my_project*.whl. However, that is difficult to incorporate into building a docker image. The wheel is outside the project with the Dockerfile, so docker will not be able to find it without jumping through a bunch of hoops, while downloading it from the server during the docker build is simple, but fails due to the dash/underscore problem.
Additionally, while both projects are being developed, I would like the CI pipeline for the development branch to use the pre-release version. Getting access to the wheel file (without having pip download it) is nearly impossible in that situation.
It seems that Cargo insists on the format being #.#.#-string and pip insists on it being #.#.#_string. Is there a way to make both of them happy?
Versions:
Installing project
pip 22.1
python 3.9.12
Building project
pip 20.0.4
python 3.9.12
maturin 0.8.3
rustc 1.56.1 (59eed8a2a 2021-11-01)
Related
Hi Guys, I am trying to install spacy model == 2.3.5 but I am getting this error, please help me!
Try using python 3.6-3.9 instead, where there are binary wheels for pip install to use instead of having to compile from source.
(This is a conflict with python 3.10 and some generated .cpp files in the source package. Python 3.10 wasn't released yet when this version was published.)
I had the similar error while executing pip install -r requirements.txt but for aiohttp module:
socket.c -o build/temp.linux-armv8l-cpython-311/aiohttp/_websocket.o
aiohttp/_websocket.c:198:12: fatal error: 'longintrepr.h' file not found
#include "longintrepr.h"
^~~~~~~ 1 error generated.
error: command '/data/data/com.termux/files/usr/bin/arm-linux-androideabi-clang'
failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for aiohttp
Failed to build aiohttp
ERROR: Could not build wheels for aiohttp, which is required to install
pyproject.toml-based projects
Just in case I will leave here solution to my error. This error is specific to Python 3.11 version. On Python with 3.10.6 version installation went fine.
To solve it I needed to update requirements.txt.
Not working versions of modules with Python 3.11:
aiohttp==3.8.1
yarl==1.4.2
frozenlist==1.3.0
Working versions:
aiohttp==3.8.2
yarl==1.8.1
frozenlist==1.3.1
Links to the corresponding issues with fixes:
https://github.com/aio-libs/aiohttp/issues/6600
https://github.com/aio-libs/yarl/issues/706
https://github.com/aio-libs/frozenlist/issues/305
Try using:
!pip install spacy==2.3.5
Do not give space between == and 2.3.5
If you give any space between equal sign and version, it may give error.
I am trying to use tox to test a graphics package I am working on. One of its dependencies is pycairo, so when I set up my tox.ini file, I specify it under deps like so:
[testenv]
deps =
pycairo
...(some other packages)
and while my tests work fine on Windows, when I try testing the package on MacOS, the test always fails with the following error when I try to pip-install pycairo:
pip3 install pycairo
Collecting pycairo
Using cached pycairo-1.20.1.tar.gz (344 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Collecting pygame
Downloading pygame-2.0.1-cp39-cp39-macosx_10_9_intel.whl (6.9 MB)
Building wheels for collected packages: pycairo
Building wheel for pycairo (PEP 517): started
Building wheel for pycairo (PEP 517): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /Users/appveyor/projects/cpython-cmu-graphics-0l7rb/.tox/py39/bin/python /Users/appveyor/projects/cpython-cmu-graphics-0l7rb/.tox/py39/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/5s/g225f6nd6jl4g8tshbh1ltk40000gn/T/tmpnqn0c3o6
cwd: /private/var/folders/5s/g225f6nd6jl4g8tshbh1ltk40000gn/T/pip-install-1vu11s7g/pycairo_6159cae3f6b14ec3a8681d1238fa6919
Complete output (12 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-3.9
creating build/lib.macosx-10.15-x86_64-3.9/cairo
copying cairo/__init__.py -> build/lib.macosx-10.15-x86_64-3.9/cairo
copying cairo/__init__.pyi -> build/lib.macosx-10.15-x86_64-3.9/cairo
copying cairo/py.typed -> build/lib.macosx-10.15-x86_64-3.9/cairo
running build_ext
Requested 'cairo >= 1.15.10' but version of cairo is 1.12.14
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for pycairo
Failed to build pycairo
ERROR: Could not build wheels for pycairo which use PEP 517 and cannot be installed directly
I established that the main reason I'm getting this error is because wheels and Cairo binary files are not provided for the pip installation of pycairo on MacOS. (It's worth noting that I'm running my MacOS tests via a remote VM) As such, I tried to install cairo first using Homebrew like so:
brew install cairo
However, whenever I retry the tests, I still get the same error message. I read on another SO post that you should brew install pkg-config as well, so in addition to the brew installation above, I also did:
brew install pkg-config
And still ended up with the same error message when I retried the tests. Frustrated, I once again took to Stack Overflow and discovered that you can directly install pycairo (as well as its dependencies, like cairo) with one single brew install command:
brew install py3cairo
Now, whenever I SSH'd into the Mac VM, running the test files worked, but because tox runs tests inside of virtual environments, it can't access this version of pycairo.
Now, one nasty, probably-horrible-practice, brute-force solution I found was to print out the path of the pycairo directory using this small Python script:
import os
import cairo
print(os.path.dirname(cairo.__file__))
And then I cp'd that directory into a virtual environment and found that it actually allows you to run import cairo without getting an error.
cp -r <path>/cairo venv3.9/lib/python3.9/site-packages
Python 3.9.1 (default, Dec 26 2020, 00:12:24)
[Clang 12.0.0 (clang-1200.0.32.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
>>>
However, not surprisingly, this doesn't seem to work with any other Python minor version that I'm testing, and I wouldn't be surprised if this breaks the library in other ways I haven't discovered yet. So that's not really an acceptable solution either.
What can I do to make my tests run properly? In my tests I just want to simulate an environment that already has all the package dependencies installed, but with pycairo it doesn't seem like there's a way for me to access the package.
I just need this to work in tox for testing purposes only. I don't anticipate anyone using our package inside of a virtual environment, so our users should just be able to install py3cairo via brew directly to their system in the worst case.
Most likely, it looks like I need a way to install cairo and pkg-config such that pip inside of a virtual environment can access those files and still install the Python bindings. But I'm also open to any other suggestions that would just allow my tox tests to run. Does anyone have any thoughts on how to fix this?
Requested 'cairo >= 1.15.10' but version of cairo is 1.12.14
Your issue is not about package discoverability but an out-of-date version. If the brew-installed version of cairo is newer than 1.15.10 then you might have a separate cairo installation lying around which gets preferred over your brew-installed version.
To reproduce the issue, I did the following:
brew install cairo
python -m venv cairo
source cairo/bin/activate
pip install pycairo
which worked as expected (Python 3.9.1, pip 20.2.3).
I'm trying to use Python build tools to run CI for my project.
However the recomended "Install Python" task fails with Unable to process command '##vso[task.setvariable :
2018-11-27T09:01:45.8077207Z ##[section]Starting: Install Python
2018-11-27T09:01:45.8084595Z ==============================================================================
2018-11-27T09:01:45.8084738Z Task : Install Python on Windows
2018-11-27T09:01:45.8084853Z Description : Installs one or more Python versions into your build environment
2018-11-27T09:01:45.8084937Z Version : 1.0.13
2018-11-27T09:01:45.8085016Z Author : Steve Dower
2018-11-27T09:01:45.8085188Z Help : The *Install Python* task will install Python using a package from [nuget.org](https://nuget.org) and add it to `PATH`. These packages are part of the official release of CPython.
Most other tasks assume you have already run this task to install the desired runtime. The folder where they are installed is customizable, but be aware that you may need to update subsequent task configuration if you change this.
The recommended configuration for using this task with multiple versions of Python is to enable multi-configuration on the phase and specify the version number as a Multiplier. See [the documentation](https://go.microsoft.com/fwlink/?linkid=835763) for information about parallel execution.
(Note that the first-party *Use Python Version* task is preferable on the Hosted queues and works on all platforms, though as of 02 May 2018 is not fully available.)
2018-11-27T09:01:45.8085489Z ==============================================================================
2018-11-27T09:02:00.5624146Z ##[command]"C:\vsts-agent\_work\_tasks\InstallPython_6095fbbe-853d-4f2e-bc15-a88c92a78b4d\1.0.13\nuget.exe" install -OutputDirectory "C:\vsts-agent\_work\_tool\PythonNuget" python
2018-11-27T09:02:02.3259235Z Feeds used:
2018-11-27T09:02:02.3260274Z https://api.nuget.org/v3/index.json
2018-11-27T09:02:02.3265409Z
2018-11-27T09:02:02.3356523Z Installing package 'python' to 'C:\vsts-agent\_work\_tool\PythonNuget'.
2018-11-27T09:02:03.3744998Z GET https://api.nuget.org/v3/registration3-gz-semver2/python/index.json
2018-11-27T09:02:04.2195046Z OK https://api.nuget.org/v3/registration3-gz-semver2/python/index.json 844ms
2018-11-27T09:02:04.6414413Z Package "python.3.7.1" is already installed.
2018-11-27T09:02:04.9698862Z ##[error]Unable to process command '##vso[task.setvariable variable=pythonLocation;issecret=False]C:\vsts-agent\_work\_tool\PythonNuget\python.3.7.1\tools' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
2018-11-27T09:02:04.9723742Z ##[error]Value cannot be null.
Parameter name: RefName
2018-11-27T09:02:05.0583055Z ##[section]Finishing: Install Python
The install itself seems to have worked, because I can disable that step and run the package task with the variable manually set.
However this task also fails with a similar error:
2018-11-27T09:19:58.1789219Z ##[section]Starting: Build wheels from setup.py
2018-11-27T09:19:58.1797911Z ==============================================================================
2018-11-27T09:19:58.1798116Z Task : Build Python wheels
2018-11-27T09:19:58.1798220Z Description : Creates a wheel using an installed copy of Python.
2018-11-27T09:19:58.1798313Z Version : 1.0.6
2018-11-27T09:19:58.1798408Z Author : Steve Dower
2018-11-27T09:19:58.1798530Z Help : The *Build Python wheels* task uses a `setup.py` file to compile wheels. It will ensure that `pip`, `wheel`, `setuptools` and `cython` are installed before running.
2018-11-27T09:19:58.1798632Z ==============================================================================
2018-11-27T09:20:00.1574022Z ##[command]"C:\vsts-agent\_work\_tool\PythonNuget\python.3.7.1\tools\python.exe" -m pip install pip setuptools wheel cython
2018-11-27T09:20:09.3277504Z Requirement already satisfied: pip in c:\vsts-agent\_work\_tool\pythonnuget\python.3.7.1\tools\lib\site-packages (10.0.1)
2018-11-27T09:20:09.3647762Z Requirement already satisfied: setuptools in c:\vsts-agent\_work\_tool\pythonnuget\python.3.7.1\tools\lib\site-packages (39.0.1)
2018-11-27T09:20:09.4030940Z Collecting wheel
2018-11-27T09:20:10.1048438Z Downloading https://files.pythonhosted.org/packages/ff/47/1dfa4795e24fd6f93d5d58602dd716c3f101cfd5a77cd9acbe519b44a0a9/wheel-0.32.3-py2.py3-none-any.whl
2018-11-27T09:20:10.2095319Z Collecting cython
2018-11-27T09:20:10.8171412Z Downloading https://files.pythonhosted.org/packages/de/c8/daeef2f83ae402fc3c3eef4295e07fc46b267e5f12c7a8ee05b685de5c59/Cython-0.29.1-cp37-cp37m-win_amd64.whl (1.7MB)
2018-11-27T09:20:11.6943676Z Installing collected packages: wheel, cython
2018-11-27T09:20:11.8283445Z The script wheel.exe is installed in 'C:\vsts-agent\_work\_tool\PythonNuget\python.3.7.1\tools\Scripts' which is not on PATH.
2018-11-27T09:20:11.8283671Z Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
2018-11-27T09:20:15.3438913Z The scripts cygdb.exe, cython.exe and cythonize.exe are installed in 'C:\vsts-agent\_work\_tool\PythonNuget\python.3.7.1\tools\Scripts' which is not on PATH.
2018-11-27T09:20:15.3439571Z Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
2018-11-27T09:20:15.3891222Z Successfully installed cython-0.29.1 wheel-0.32.3
2018-11-27T09:20:15.8153804Z You are using pip version 10.0.1, however version 18.1 is available.
2018-11-27T09:20:15.8154881Z You should consider upgrading via the 'python -m pip install --upgrade pip' command.
2018-11-27T09:20:15.9164164Z ##[command]"C:\vsts-agent\_work\_tool\PythonNuget\python.3.7.1\tools\python.exe" "C:\vsts-agent\_work\1\s\setup.py" build --build-base "C:\vsts-agent\_work\1\b" bdist_wheel -d "C:\vsts-agent\_work\1\a" --universal
2018-11-27T09:20:17.2811564Z running build
2018-11-27T09:20:17.2812503Z running build_py
2018-11-27T09:20:17.7476566Z creating C:\vsts-agent\_work\1\b\lib
2018-11-27T09:20:17.7478546Z creating C:\vsts-agent\_work\1\b\lib\pvsdockerlib
2018-11-27T09:20:17.7487714Z copying pvsdockerlib\functions.py -> C:\vsts-agent\_work\1\b\lib\pvsdockerlib
2018-11-27T09:20:17.7509731Z copying pvsdockerlib\__init__.py -> C:\vsts-agent\_work\1\b\lib\pvsdockerlib
2018-11-27T09:20:17.7528017Z running bdist_wheel
2018-11-27T09:20:17.7948184Z installing to C:\vsts-agent\_work\1\b\bdist.win-amd64\wheel
2018-11-27T09:20:17.7950366Z running install
2018-11-27T09:20:17.7960351Z running install_lib
2018-11-27T09:20:17.8287382Z creating C:\vsts-agent\_work\1\b\bdist.win-amd64
2018-11-27T09:20:17.8290061Z creating C:\vsts-agent\_work\1\b\bdist.win-amd64\wheel
2018-11-27T09:20:17.8300030Z creating C:\vsts-agent\_work\1\b\bdist.win-amd64\wheel\pvsdockerlib
2018-11-27T09:20:17.8310198Z copying C:\vsts-agent\_work\1\b\lib\pvsdockerlib\functions.py -> C:\vsts-agent\_work\1\b\bdist.win-amd64\wheel\.\pvsdockerlib
2018-11-27T09:20:17.8333787Z copying C:\vsts-agent\_work\1\b\lib\pvsdockerlib\__init__.py -> C:\vsts-agent\_work\1\b\bdist.win-amd64\wheel\.\pvsdockerlib
2018-11-27T09:20:17.8348679Z running install_egg_info
2018-11-27T09:20:18.0161526Z running egg_info
2018-11-27T09:20:18.0162158Z creating pvs_dockerlib.egg-info
2018-11-27T09:20:18.0169182Z writing pvs_dockerlib.egg-info\PKG-INFO
2018-11-27T09:20:18.0184157Z writing dependency_links to pvs_dockerlib.egg-info\dependency_links.txt
2018-11-27T09:20:18.0199803Z writing requirements to pvs_dockerlib.egg-info\requires.txt
2018-11-27T09:20:18.0208911Z writing top-level names to pvs_dockerlib.egg-info\top_level.txt
2018-11-27T09:20:18.0227310Z writing manifest file 'pvs_dockerlib.egg-info\SOURCES.txt'
2018-11-27T09:20:18.0262855Z reading manifest file 'pvs_dockerlib.egg-info\SOURCES.txt'
2018-11-27T09:20:18.0307698Z writing manifest file 'pvs_dockerlib.egg-info\SOURCES.txt'
2018-11-27T09:20:18.0320556Z Copying pvs_dockerlib.egg-info to C:\vsts-agent\_work\1\b\bdist.win-amd64\wheel\.\pvs_dockerlib-0.1-py3.7.egg-info
2018-11-27T09:20:18.0449785Z running install_scripts
2018-11-27T09:20:18.2548207Z adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
2018-11-27T09:20:18.2597715Z creating C:\vsts-agent\_work\1\b\bdist.win-amd64\wheel\pvs_dockerlib-0.1.dist-info\WHEEL
2018-11-27T09:20:18.2616849Z creating 'C:\vsts-agent\_work\1\a\pvs_dockerlib-0.1-py2.py3-none-any.whl' and adding 'C:\vsts-agent\_work\1\b\bdist.win-amd64\wheel' to it
2018-11-27T09:20:18.2642603Z adding 'pvsdockerlib/__init__.py'
2018-11-27T09:20:18.2660569Z adding 'pvsdockerlib/functions.py'
2018-11-27T09:20:18.2668323Z adding 'pvs_dockerlib-0.1.dist-info/LICENSE'
2018-11-27T09:20:18.2674321Z adding 'pvs_dockerlib-0.1.dist-info/METADATA'
2018-11-27T09:20:18.2679798Z adding 'pvs_dockerlib-0.1.dist-info/WHEEL'
2018-11-27T09:20:18.2685103Z adding 'pvs_dockerlib-0.1.dist-info/top_level.txt'
2018-11-27T09:20:18.2688000Z adding 'pvs_dockerlib-0.1.dist-info/RECORD'
2018-11-27T09:20:18.2691808Z removing C:\vsts-agent\_work\1\b\bdist.win-amd64\wheel
2018-11-27T09:20:18.2719804Z C:\vsts-agent\_work\_tool\PythonNuget\python.3.7.1\tools\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
2018-11-27T09:20:18.2720555Z warnings.warn(msg)
2018-11-27T09:20:18.5079776Z ##[error]Unable to process command '##vso[task.setvariable variable=dist;issecret=False]C:\vsts-agent\_work\1\a' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
2018-11-27T09:20:18.5106520Z ##[error]Value cannot be null.
Parameter name: RefName
2018-11-27T09:20:18.5664259Z ##[section]Finishing: Build wheels from setup.py
How is this possible when Python build tools uses the built in powershell command Set-VstsTaskVariable?
Github Python build tools install set pythonLocation var
Github Python build tools package set dist var
Is this a bug in the azure-pipelines-agent? I'm using the latest pre-release v2.141.2, and on-prem TFS 2017 update 3.1
I'm attempting to install a package I recently create into a Heroku app. It seems that Heroku uses an older version of pip which prevents my package from installing correctly. I repeated the process with repl.it to see what happens and here is what I get:
Repl.it: Installing fresh packages
Repl.it: zoho_crm
Collecting zoho_crm
Downloading
https://files.pythonhosted.org/packages/8e/73/a1464dd121fec9579c724de6b9b3243ea733fb85d441b928ff467ec1328f/zoho_crm-0.5.tar.gz
Building wheels for collected packages: zoho-crm
Running setup.py bdist_wheel for zoho-crm: started
Running setup.py bdist_wheel for zoho-crm: finished with status 'done'
Stored in directory: /home/runner/.cache/pip/wheels/46/66/f9/c9604984f6670461c451dd9431105760405d06c658d3b44f01
Successfully built zoho-crm
Installing collected packages: zoho-crm
Successfully installed zoho-crm-0.5
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Repl.it: package installation success
Traceback (most recent call last):
File "python", line 1, in <module>
ModuleNotFoundError: No module named 'zoho_crm'
Line 1 of my code (the only line) is import zoho_crm
This is also the same error I get in Heroku.
I have no problems updating pip on my local machine, but the update with these cloud services seems to update but doesn't stick.
Any suggestions?
That version warning is only warning and can be safely ignored now. Your problem has nothing to do with pip, the problem is caused by the broken package zoho_crm — it doesn't contain anything installable, neither python modules nor packages.
I'm trying to install a pysnap library from github. This is part of the output I get. I have no idea how to proceed, any help would be greatly appreciated.
Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pysnap-0.1.1-py2.7.egg
Processing dependencies for pysnap==0.1.1
Searching for cryptography>=1.2.2
Reading https://pypi.python.org/simple/cryptography/
Best match: cryptography 1.2.3
Downloading https://pypi.python.org/packages/source/c/cryptography/cryptography-1.2.3.tar.gz#md5=5474d2b3e8c7555a60852e48d2743f85
Processing cryptography-1.2.3.tar.gz
Writing /tmp/easy_install-7ZnmT5/cryptography-1.2.3/setup.cfg
Running cryptography-1.2.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-7ZnmT5/cryptography-1.2.3/egg-dist-tmp-rcoXcx
_configtest.c:1:1: error: thread-local storage is unsupported for the current target
__thread int some_threadlocal_variable_42;
1 error generated.
error: unable to create target: 'No available targets are compatible with this triple, see -version for the
available targets.'
1 error generated.
What platform are you trying to install pysnap?
I downloaded and installed pysnap sucessfully from this github location
I do have windows 10 platform and python 2.7 though. I dont' have a linux to replicate this issue.
If you are trying to install on Linux, depending on flavor and its setup , sometimes swap is setup as as /tmp and some applications are not able to write to /tmp. In your case it does looks like its trying to write to /tmp and erroring out.
Can you try pip install cryptography
and see if its able to install cryptography part without issues?
Once that dependency is out of way, you can install pysnap so that pysnap will not try to install cryptography