I installed azure-cli with Homebrew brew update && brew install azure-cli
None of the azure commands have been successful. No matter the command I get the the following error.
az storage container create --name testContainer
No module named 'pkg_resources'
Traceback (most recent call last):
File "/usr/local/Cellar/azure-cli/2.0.45/libexec/lib/python3.7/site-packages/knack/cli.py", line 197, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/local/Cellar/azure-cli/2.0.45/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 262, in execute
self.commands_loader.load_arguments(command)
File "/usr/local/Cellar/azure-cli/2.0.45/libexec/lib/python3.7/site-packages/azure/cli/core/__init__.py", line 253, in load_arguments
self.command_table[command].load_arguments() # this loads the arguments via reflection
File "/usr/local/Cellar/azure-cli/2.0.45/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 141, in load_arguments
super(AzCliCommand, self).load_arguments()
File "/usr/local/Cellar/azure-cli/2.0.45/libexec/lib/python3.7/site-packages/knack/commands.py", line 76, in load_arguments
cmd_args = self.arguments_loader()
File "/usr/local/Cellar/azure-cli/2.0.45/libexec/lib/python3.7/site-packages/azure/cli/core/__init__.py", line 440, in default_arguments_loader
op = handler or self.get_op_handler(operation)
File "/usr/local/Cellar/azure-cli/2.0.45/libexec/lib/python3.7/site-packages/azure/cli/core/__init__.py", line 485, in get_op_handler
op = import_module(mod_to_import)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/local/Cellar/azure-cli/2.0.45/libexec/lib/python3.7/site-packages/azure/multiapi/__init__.py", line 1, in <module>
__import__('pkg_resources').declare_namespace(__name__)
ModuleNotFoundError: No module named 'pkg_resources'
I've attempted to do pip install setuptools
which gives me:
Requirement already satisfied: setuptools in ./Library/Python/2.7/lib/python/site-packages (40.4.1)
Is azure trying to use a different version of python that's missing setup tools? Am I using the wrong version of python?
I don't really know where to go from here.
python --version says i'm using Python 3.7.0
As you say none of the azure commands have been successful. So I suggest you reinstall the Azure CLI, you can follow Install Azure CLI 2.0.
Additional, install Azure CLI through python:
pip install --pre --user azure-nspkg
pip install --pre --user azure-multiapi-storage
pip install azure-cli
For more details, follow this link.
About create a container for the storage. You can do that with the CLI command here:
az storage container create --name containerName --account-name accountName --account-key accountKey
And the container name has the limitation here:
A container organizes a set of blobs, similar to a folder in a file
system. All blobs reside within a container. A storage account can
contain an unlimited number of containers, and a container can store
an unlimited number of blobs. Note that the container name must be
lowercase.
So you should pay attention to it. Hope this will help you.
Related
So I have been working on a battleship game project in pygame and wanted to start recording game results to help with building an AI. Unfortunately when I go through with this command for pyinstaller:
pyinstaller -D -w -n Battleship -F Gui.py
It goes through and creates the exe with no issue, when I go to launch the exe it throws this error seen in the picture below.
Following that path in the error it seems to be when I call my database script then when I try and import pymongo. If I exclude the database side of my script when I make the exe it runs just find and of course is just missing the database interaction portion.
I am running this through pycharm and it works just fine in this development setting but again when I go to create an exe through pyinstaller it results in the error.
Edit 1: So I have run this now without the -w in cmd window and recieved the following:
C:\Users\14402\SynologyDrive\BattleShip\dist>Battleship.exe
Traceback (most recent call last):
File "Gui.py", line 3, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
File "DataBase.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
File "pymongo\__init__.py", line 102, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
File "pymongo\collection.py", line 38, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
File "pymongo\common.py", line 42, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
File "pymongo\compression_support.py", line 18, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
File "snappy\__init__.py", line 20, in <module>
File "snappy\__init__.py", line 11, in _delvewheel_init_patch_0_0_9
File "os.py", line 1111, in add_dll_directory
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\14402\\AppData\\Local\\Temp\\_MEI1811162\\python_snappy.libs'
[152752] Failed to execute script 'Gui' due to unhandled exception!
Along with this I have checked to see if python-snappy is installed and it is:
PS C:\Users\14402\SynologyDrive\BattleShip> pip install python-snappy
Requirement already satisfied: python-snappy in c:\users\14402\synologydrive\battleship\venv\lib\site-packages (0.6.1)
WARNING: Error parsing requirements for pytz: [Errno 2] No such file or directory: 'c:\\users\\14402\\synologydrive\\battleship\\venv\\lib\\site-packages\\pytz-2022.2.1.dist-info\\METADATA'
Finally I will be going through tomorrow and seeing if I can make a simplified version to see if I can better pinpoint, but from my testing this gets thrown when the exe is starting and hits the import for pymongo.
So after Alexander said they were able to open things and run it no problem. I created a new project and pulled over all the code and reimported the libraries and it ran just fine. I must have something hanging over in my previous project in my library that is causing the problem but it is resolved now! Thank you all for your questions and help, first time posting and it was a bit rough.
I have been trying to build a Windows executable from Python files using PyInstaller (and auto-py-to-exe, but the problem really resides with PyInstaller). Once the executable is built (using --onedir) , I try to launch it and it crashes with this error message:
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "sklearn\feature_selection\__init__.py", line 28, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "sklearn\feature_selection\_mutual_info.py", line 9, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "sklearn\neighbors\__init__.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 1050, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "sklearn\neighbors\_ball_tree.pyx", line 1, in init sklearn.neighbors._ball_tree
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'sklearn.neighbors._partition_nodes'
[17176] Failed to execute script 'Make_Model' due to unhandled exception!
I have tried to add sklearn.neighbors._partition_nodes to the hidden imports list, but I still obtain the same error message. I have looked at the very helpful auto-py-to-exe page and the not-as-helpful PyInstaller page, but nothing specific to my problem can be found.
I know that scikit-learn is notoriously difficult to deal with when it comes to PyInstaller, but can anybody provide some guidance about this problem?
In case someone asks, the code is written in Python 3.7.11 in a Windows 10 environment.
I managed to resolve this by doing what sometimes is the best solution: I deleted all my previous attempts at building the executable and re-started afresh using solely auto-py-to-exe. This time, adding sklearn.neighbors._partition_nodes to the hidden import list worked. I was then able to move on to the next problem (XGBoost), but there are plenty of answers available for that.
I dont understand why pip is not installed with python (I had a check mark in installer).
py -m pip returns no module named pip
I have windows 7, python 3.7.4 installed to c:\python.
tried different versions of python however, when i try install pip with get-pip.py i get:
C:\Python>python get-pip.py
Traceback (most recent call last):
File "get-pip.py", line 22308, in <module>
main()
File "get-pip.py", line 197, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
import pip._internal
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Temp\tmpx8wd2cnb\pip.zip\pip\_internal\__init__.py", line 40, in <mod
ule>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
many same errors (cant posted all of it here)
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Temp\tmpx8wd2cnb\pip.zip\pip\_vendor\requests\compat.py", line 64, in
<module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 724, in exec_module
File "<frozen importlib._bootstrap_external>", line 859, in get_code
File "<frozen importlib._bootstrap_external>", line 917, in get_data
OSError: [Errno 9] Bad file descriptor
Will be grateful for answer.
You are probably facing this issue because when you are installing python in the scripts folder pip is not getting installed ,I was facing the same problem 2 weeks back , when I searched the official site of python I finally found my answer to this problem.
1)Firstly install python the way you were doing that.
2)Next step is to run this command in your terminal: python -m ensurepip --default-pip
3)After running this command pip will successfully get installed to your system , check your scripts folder you will find the pip file there.
I downloaded python 3, and it works correctly on a basic script, but when i tried to import a package with pip in cmd, it said it didn't recognise "pip"
I'm on windows 10
I've tried to install different versions of python. I've also tried to install pip by itself at https://pip.pypa.io/en/stable/installing/.
When I try python -m ensurepip or python get-py.py i get this error
Traceback (most recent call last):
File "get-pip.py", line 22312, in <module>
main()
File "get-pip.py", line 197, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
import pip._internal
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_internal\__init__.py", line 40, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_internal\cli\autocompletion.py", line 8, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_internal\cli\main_parser.py", line 11, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_internal\commands\__init__.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_internal\commands\completion.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_internal\cli\base_command.py", line 21, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_internal\download.py", line 14, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_vendor\requests\__init__.py", line 114, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_vendor\requests\utils.py", line 26, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_vendor\requests\_internal_utils.py", line 11, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "C:\Users\I56600~1\AppData\Local\Temp\tmpgkogcd_v\pip.zip\pip\_vendor\requests\compat.py", line 64, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 724, in exec_module
File "<frozen importlib._bootstrap_external>", line 859, in get_code
File "<frozen importlib._bootstrap_external>", line 917, in get_data
OSError: [Errno 9] Bad file descriptor
C:\Users\I5 6600k\Downloads>pip
'pip' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\I5 6600k\Downloads>python -m pip
C:\Users\I5 6600k\AppData\Local\Programs\Python\Python37\python.exe: No module named pip
I faced a similar issue. My system went through python installation and uninstallation couple of times. Also I created virtual environment few months back using pip.
Recently when I reinstalled python, Scripts folder was empty.
I searched for all Scripts folder from my root directory (This PC). I found some old Scripts folder containing pip packages. I removed those old Scripts folders, uninstalled python and installed again. Now it works.
I strongly recommend you to try this option. Don't forget to check "add PATH to env variable" option while installing python. Hope this helps.
Did you clicked to 'Path' when installing python? If no, then try to uninstall the python, and when edgy install of the python, click to add 'path'.
I’m running into an issue getting pyInstaller to bundle a module that contains SWIG modules. I have followed each of the guidelines listed in the pyInstaller doc which details SWIG support.
I get the following error when running the exe:
# sphinxbase._ad_win32 not found in PYZ
Traceback (most recent call last):
File "StartListening.py", line 10, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "c:\users\allen\appdata\local\programs\python\python36-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\sphinxbase\__init__.py", line 35, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "c:\users\allen\appdata\local\programs\python\python36-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\sphinxbase\ad_win32.py", line 32, in <module>
File "site-packages\sphinxbase\ad_win32.py", line 31, in swig_import_helper
File "importlib\__init__.py", line 126, in import_module
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'sphinxbase._ad_win32'
However, sphinxbase._ad_win32 does exists as a pyd file. I’m running Windows 10; why is pyInstaller having trouble bundling this module?
The third-party package I’m ultimately trying to import is SpeechRecognition which depends on pocketsphinx which depends on sphinxbase which is the module that is having issues.
Here is the object reference returned by
importlib.import_module('sphinxbase._ad_win32')
in the SWIG-generated python wrapper if that is helpful to someone:
<module 'sphinxbase._ad_win32' from 'C:\\Users\\bob\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\site-packages\\sphinxbase\\_ad_win32.pyd'>
Python version: 3.6.5
Edit: After some more research, I tried adding the .pyd to the 'binaries' list in the .spec file as well as adding 'sphinxbase._ad_win32' to the 'hidden-imports' list and combinations there-between, but this did not work either. The binary is there, in the correct location, I can't figure out why the bundled app can't find it.