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

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

Related

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

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.

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

Unable to install top2vec

I'm trying to install top2vec for my topic analysis project. To install, I've used this command pip install top2vec. The installation process starts normally but it ends with this error:
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'
error: subprocess-exited-with-error
python setup.py egg_info did not run successfully.
exit code: 1
[8 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\Asus\AppData\Local\Temp\pip-install-grwckgy_\numba_5149fd90a1d24717819bfa776cf85678\setup.py", line 51, in <module>
_guard_py_ver()
File "C:\Users\Asus\AppData\Local\Temp\pip-install-grwckgy_\numba_5149fd90a1d24717819bfa776cf85678\setup.py", line 48, in _guard_py_ver
raise RuntimeError(msg.format(cur_py, min_py, max_py))
RuntimeError: Cannot install on Python version 3.11.1; only versions >=3.7,<3.11 are supported.
[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.
My pip version is: pip 22.3.1
The error your paste tell you everything:
File "C:\Users\Asus\AppData\Local\Temp\pip-install-grwckgy_\numba_5149fd90a1d24717819bfa776cf85678\setup.py", line 48, in _guard_py_ver
raise RuntimeError(msg.format(cur_py, min_py, max_py))
RuntimeError: Cannot install on Python version 3.11.1; only versions >=3.7,<3.11 are supported.
The root cause is when top2vec try to install its dependency numba, it said it can only support version >=3.7, <3.11, while your python version is 3.11.1.
See this and this:
We have not released numba and llvmlite for python3.11. The new python version is requiring massive changes to numba because of how numba is tightly coupled to Python’s bytecode internals.
The Python 3.11 support for the Numba project, for example, is still a work-in-progress as of Dec 8, 2022. Apparently it took them 6 months post-release until they had Python 3.9 support, and 3 months after 3.10.
So, you can monitor this official issue to see their update, or downgrade your python version.

Can't install python packages on my ubuntu virtual machine

This is the full script:
(venv) ubuntu#ubuntu:~$ pip install wxPython
Collecting wxPython
Using cached wxPython-4.2.0.tar.gz (71.0 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [12 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-jlwwpkvj/wxpython_66c7996a596740a4b92c4f3a3724336d/setup.py", line 27, in <module>
from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
File "/tmp/pip-install-jlwwpkvj/wxpython_66c7996a596740a4b92c4f3a3724336d/buildtools/config.py", line 30, in <module>
from attrdict import AttrDict
File "/home/ubuntu/PycharmProjects/pythonProject/venv/lib/python3.10/site-packages/attrdict/__init__.py", line 5, in <module>
from attrdict.mapping import AttrMap
File "/home/ubuntu/PycharmProjects/pythonProject/venv/lib/python3.10/site-packages/attrdict/mapping.py", line 4, in <module>
from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.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.
(venv) ubuntu#ubuntu:~$
I think cause of the problem is virtuel machine. I can download packages on my host OS.
I am using UTM for ubuntu.
I try updating pip and setuptolls. I reinstalled differently ubuntu for multiple times.
I am searcing forums for weeks and still nothing.
You need to use an older version of Python (I am guessing 3.9). The best option is probably to set it up in virtualenv like this:
sudo apt update
sudo apt install python3.9
sudo apt-get install python3.9-dev python3.9-venv
python3.9 -m venv myenv
source venv/bin/activate
pip install wxPython
Try to download the wheel (*.whl) file for that package and then:
pip install <wheel file path>

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