I have definitely installed this package locally, called app. However, I am not able to run a Python file where it imports this package and get the ModuleNotFound error.
PS C:\clippd\clippd-meta-functions\app> python -m pip install -e .
Obtaining file:///C:/clippd/clippd-meta-functions/app
Preparing metadata (setup.py) ... done
Installing collected packages: app
Attempting uninstall: app
Found existing installation: app 0.1.0
Uninstalling app-0.1.0:
Successfully uninstalled app-0.1.0
Running setup.py develop for app
Successfully installed app-0.1.0
PS C:\clippd\clippd-meta-functions\app> & C:/Users/rijul/AppData/Local/Microsoft/WindowsApps/python3.10.exe c:/clippd/clippd-meta-functions/app/gamification/complete_flow.py
Traceback (most recent call last):
File "c:\clippd\clippd-meta-functions\app\gamification\complete_flow.py", line 5, in <module>
from app.gamification.streaks.intra_round.ir_class import (
ModuleNotFoundError: No module named 'app'
Ummmm, I think you have different version python
Related
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
I have this package, setuptools, installed on my local machine as you will in the command line code attached, but I don't understand why I keep getting the modulenotfound error.
PS C:\Users\MY PC\desktop\django-polls> easy_install --version
setuptools 41.2.0 from c:\users\my pc\appdata\local\programs\python\python38\lib\site-packages (Python 3.8)
PS C:\Users\MY PC\desktop\django-polls> python setup.py sdist
Traceback (most recent call last):
File "setup.py", line 1, in <module>
from setuptools import setup
ModuleNotFoundError: No module named 'setuptools'
PS C:\Users\MY PC\desktop\django-polls> pip install setuptools
Requirement already satisfied: setuptools in c:\users\my pc\anaconda3\lib\site-packages (52.0.0.post20210125)
PS C:\Users\MY PC\desktop\django-polls> python setup.py sdist
Traceback (most recent call last):
File "setup.py", line 1, in <module>
from setuptools import setup
ModuleNotFoundError: No module named 'setuptools'
PS C:\Users\MY PC\desktop\django-polls>
If you are using a virutal environment that may be the reason you are experiencing this. Try installing the package while the VE is active.
However, I am learning Django myself but figured I would give it a shot. Good luck.
This may not work but did you try to install it in the working directory I see you have it in the "my pc" directory
Try to install it in the working directory of "django-polls" and check whether it works or not.
Let me know if that does anything for you.
It looks you are not in virtual environment, please try to create new or use existing virtual environment and install all required package including django in it.
I have the following package structure:
setup.py
/cpp_graph_test
fastgraph.pyx
graph.cpp
graph.h
graph.pxd
heap.cpp
heap.h
__init__.py
I've created a setup.py as follows:
from setuptools import Extension, setup
from Cython.Build import cythonize
sourcefiles = ['cpp_graph_test/fastgraph.pyx', 'cpp_graph_test/graph.cpp', 'cpp_graph_test/heap.cpp']
extensions = [
Extension(
name="cpp_graph_test.fastgraph",
sources=sourcefiles,
extra_compile_args=['-O3']
)
]
setup(
name='cpp_graph_test',
packages=['cpp_graph_test'],
ext_modules=cythonize(extensions, language_level=3, include_path=["cpp_graph_test"]),
version='0.0.1'
)
I install, and things seem to go fine...
$ sudo pip3 install .
Processing /home/le_user/Documents/cpp_graph_test
Preparing metadata (setup.py) ... done
Building wheels for collected packages: cpp-graph-test
Building wheel for cpp-graph-test (setup.py) ... done
Created wheel for cpp-graph-test: filename=cpp_graph_test-0.0.1-cp310-cp310-linux_x86_64.whl size=641411 sha256=8e3b20a0bec7a8f5a739deba272289bce370ab99abae02a3787d3f10718b03c9
Stored in directory: /tmp/pip-ephem-wheel-cache-ofm34m2v/wheels/c1/03/6a/f746b1b945b60e93aa67ee67e8e6a2c4537c0a87dbb72ffa34
Successfully built cpp-graph-test
Installing collected packages: cpp-graph-test
Attempting uninstall: cpp-graph-test
Found existing installation: cpp-graph-test 0.0.1
Uninstalling cpp-graph-test-0.0.1:
Successfully uninstalled cpp-graph-test-0.0.1
Successfully installed cpp-graph-test-0.0.1
However, this fails...
$ python3
Python 3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cpp_graph_test.fastgraph import FastGraph
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cpp_graph_test.fastgraph'
I can import the cpp_graph_test package in its entirety, but if I try to use pkgutil to list all the modules in the package, there are none.
Is there something wrong with my setup.py file?
EDIT: When I run the install with pip, the pyx file is translated to C++, and I get binary generated in the build directory, so the Cython build is running, and apparently not creating errors.
EDIT2: While experimenting, I got this error: ImportError: cannot import name 'FastGraph' from 'cpp_graph_test' (/home/le_user/Documents/cpp_graph_test/cpp_graph_test/__init__.py) This error makes it seem like Python is looking at the raw code for the package instead of looking at the actual built, installed package after the pip install. It's like there's some weird symlink somewhere or something...
EDIT3: I can sudo pip3 uninstall cpp_graph_test and it'll tell me "skipping cpp_graph_test as it is not installed." But then I can start a Python shell (from any folder) and say import cpp_graph_test and it'll be successful. Not sure how to uninstall a package that's already uninstalled but that lives on anyway?
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've made two packages (pphp and xmlx) and distributed and uploaded them the standard way, using python setup.py sdist bdist_wheel and twine upload dist/*.
I then tried installing them using pip install, and it seemed to work fine... but then, in the interactive shell:
>>> import xmlx
Traceback (most recent call last):
File <module>, line 1:
import xmlx
ImportError: No module named xmlx
I then tried python setup.py install but same result (seemed fine but didn't work).
So what's going on?
This is the repository for xmlx, yes? Your setup.py declares the packages in your project with packages=find_packages(), but your project does not contain any import packages, only a single-file module, xmlx.py. This must be declared in your setup.py by instead writing:
py_modules=['xmlx']
(Also, dist/ and *.egg-info/ are build artifacts and should not be stored in version control; I recommend adding them to your .gitignore.)