How to use requirements.txt with direct github source in virtual environment - python

Sometimes I am must use python modules from github projects. I am can do it in my my_requirements.txt as
git+https://github.com/zackhodari/tts_data_tools
And I am wand use python virtual environment for experiments because I am do not want lots of garbage on my machine.
pip install -r my_requirements.txt
This is approach work all right for good quality github projects with good requirements.txt. Unfortunate there lots of other projects with inconsistent requirements.txt. Those projects requires some modules pre-installation for compilation.
Ok. I am wrote in my my_requirements.txt something like
numpy
git+https://github.com/zackhodari/tts_data_tools
and get "module numpy not found" error because PIP do compilation of github project not in my virtual environment.
What I am must do for github projects compilation inside my environment
Here is fulk error message
Collecting git+https://github.com/zackhodari/tts_data_tools (from -r requirements.txt (line 2))
Cloning https://github.com/zackhodari/tts_data_tools to c:\users\XXX\appdata\local\temp\pip-req-build-4kv5zmyx
Running command git clone --filter=blob:none --quiet https://github.com/zackhodari/tts_data_tools 'C:\Users\XXX\AppData\Local\Temp\pip-req-build-4kv5zmyx'
Resolved https://github.com/zackhodari/tts_data_tools to commit 3c1aff21ab0fbed1bbfd2ba8a5a16d0eb610ffe1
Preparing metadata (setup.py) ... done
Collecting numpy
Using cached numpy-1.24.2-cp38-cp38-win_amd64.whl (14.9 MB)
Collecting pyreaper
Using cached pyreaper-0.0.8.tar.gz (124 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\XXX\AppData\Local\Temp\pip-install-_4t7gi1p\pyreaper_27e0fd80dcb141b98b17dd963414e84f\setup.py", line 8, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

It's a bug in pyreaper: it imports numpy before installing it. So you need to install numpy first.
Unfortunately this cannot be done via my_requirements.txt. If you add numpy in it pip downloads and unpacks numpy but not fully install it so other packages that require numpy cannot import it yet until the entire my_requirements.txt is processed. Installation of any package in my_requirements.txt that requires any other package that isn't yet installed will fail.
Either you fully install numpy before all packages that need it. Or you report the bug, wait until it's fixed and then install any packages without pre-installing numpy.

Related

Failure Exception: ModuleNotFoundError: No module named 'azure.storage'

I have created python function to deploy onto azure function app. It runs successfully on my local machine, and successfully getting deployed onto the azure function app also. However, when I test it on my subscription, it is throwing Failure Exception: ModuleNotFoundError: No module named 'azure.storage' error. and is pointing to a line in my python file 'import azure.storage'.
EDIT: "since i changed the sequence of import modules, now the error is on appendserviceblob from azure-blob-storage"
Details:
I am using python 3.9 version and so is my functon app of linux OS.
My requirements.txt contains:
azure-core
azure-functions
azure-storage
azure-storage-blob
Please if someone can give a feedback.
I tried to amend my requirements.txt file but no luck.
Attaching photos:
requirement.tc
modules imported
azure function error
Could it be that azure-storage is deprecated?
raw output:
pip install azure-storage
Collecting azure-storage
Using cached azure-storage-0.37.0.zip (4.3 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [20 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-b5bzzs55/azure-storage_4db88e4fc79d49348bcbaf111e82d894/setup.py", line 55, in <module>
raise RuntimeError(message)
RuntimeError:
Starting with v0.37.0, the 'azure-storage' meta-package is deprecated and cannot be installed anymore.
Please install the service specific packages prefixed by `azure` needed for your application.
The complete list of available packages can be found at:
https://aka.ms/azsdk/python/all
Here's a non-exhaustive list of common packages:
- [azure-storage-blob](https://pypi.org/project/azure-storage-blob) : Blob storage client
- [azure-storage-file-share](https://pypi.org/project/azure-storage-file-share) : Storage file share client
- [azure-storage-file-datalake](https://pypi.org/project/azure-storage-file-datalake) : ADLS Gen2 client
- [azure-storage-queue](https://pypi.org/project/azure-storage-queue): Queue storage client
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
[notice] A new release of pip available: 22.3.1 -> 23.0
[notice] To update, run: python -m pip install --upgrade pip
It might be that because of this your azure function refuses to install the dependencies.
Here you can find the Azure python sdk and currently supported packages.
Kind regards

install symengine 0.6.1 pip

I would like to install nvidia modulus through the bare metal installation (since I dont have a GPU, so I cant setup the docker). So I have to install a fiew pip packages including symengine==0.6.1. I have installed all but symengine, because I have this error :
pip install symengine==0.6.1
Collecting symengine==0.6.1
Using cached symengine-0.6.1.tar.gz (721 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [14 lines of output]
error: Multiple top-level packages discovered in a flat-layout: ['cmake', 'symengine'].
To avoid accidental inclusion of unwanted files or directories,
setuptools will not proceed with this build.
If you are trying to create a single distribution with multiple packages
on purpose, you should not rely on automatic discovery.
Instead, consider the following options:
1. set up custom discovery (`find` directive with `include` or `exclude`)
2. use a `src-layout`
3. explicitly set `py_modules` or `packages` with a list of names
To find more information, look for "package discovery" on setuptools docs.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
I updated setuptools 66.1.1 and pip 22.3.1. I also installed ez_setup 0.9, but couldnt install unroll and then tried the "easy_install -U setuptools" that doesnt find easy_install.

ImportError: cannot import name 'build_py_2to3' from 'distutils.command.build_py'

I tried to install bipwallet through pip but it says there is no 'build_py_2to3' in distutils
Defaulting to user installation because normal site-packages is not writeable
Collecting bipwallet
...
Collecting protobuf==3.0.0a3
Using cached protobuf-3.0.0a3.tar.gz (88 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-q8v8yny3/protobuf_3f1a8b67130540ab9c93af7fe765918c/setup.py", line 29, in <module>
from distutils.command.build_py import build_py_2to3 as _build_py
ImportError: cannot import name 'build_py_2to3' from 'distutils.command.build_py' (/home/orkhan/.local/lib/python3.11/site-packages/setuptools/_distutils/command/build_py.py)
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
I tried to search in Google but it did not help. I also tried
pip install --upgrade distutils
thinking maybe it's just older version.
P.S. my python version 3.11
It seems as though bipwallet or one of its dependencies (protobuf-3.0.0a3?) wants to use whatever version of setuptools is available rather than pinning a specific version. setuptools v58.0.0 has a breaking change, first included in Python 3.10, where build_py_2to3 was removed.
You have a couple options:
Find the offending library and edit its setup.py to indicate that it should use setuptools<=57.5.0 and retry.
Downgrade your Python installation to 3.9 to get a local version of setuptools prior to the breaking change.
Here are a couple other related posts/links to the issue you're seeing:
https://github.com/mhammond/pywin32/issues/1813
https://bytemeta.vip/repo/StanfordVL/iGibson/issues/227
https://github.com/mobinmbn/bipwallet_fix

pip installing a local file gives me error

I am trying to install Open3D from https://github.com/isl-org/Open3D/tree/master/python because I would like to edit the code therefore I am not installing Open3D from PyPI. I downloaded the file from github to my local files and ran pip install Downloads/Open3D/python. I ran the installation under the python subdirectory because it contain setup.py and requirements.txt. However when I run the command pip install Downloads/Open3D/python, I get this error.
Processing c:\users\md fardin nahid\downloads\open3d\python
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [3 lines of output]
C:\Users\MDFARD~1\AppData\Local\Temp\pip-build-env-35qkg2d4\overlay\Lib\site-packages\setuptools\config\setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
error in #PYPI_PACKAGE_NAME# setup command: 'NoneType' object has no attribute 'group'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
I have tried directly installing from the github using pip install "git+https://github.com/isl-org/Open3D.git" which did not work because the directory did not contain setup.py or pyproject.toml.
Anyone know how I can fix this issue? or anyone know any other ways I am able to download Open3D from github so that I can edit the code? I am using anaconda. I am new to this package stuff. Thanks.
Windows 11
pip 22.2.2
python 3.7.15
git version 2.38.1.1

pip version error with installed package

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.

Categories

Resources