I am trying FASTAPI with the code below and localhost is not reachable with 127.0.0.1:8000 or localhost:8000 also. Tried setting with different port numbers also.
At the end it says
NameError: name '_TypeAliasForm' is not defined
This is on windows 10 with python 3.10
from fastapi import FastAPI
app = FastAPI()
#app.get("/")
async def root():
return {"message": "Hello World"}
PS G:\pyproj\fastapiex> uvicorn main:app --reload
←[32mINFO←[0m: Will watch for changes in these directories: ['G:\\pyproj\\fastapiex']
←[32mINFO←[0m: Uvicorn running on ←[1mhttp://127.0.0.1:8000←[0m (Press CTRL+C to quit)
←[32mINFO←[0m: Started reloader process [←[36m←[1m6936←[0m] using ←[36m←[1mwatchgod←[0m
Process SpawnProcess-1:
Traceback (most recent call last):
File "c:\users\jsl\appdata\local\programs\python\python310\lib\multiprocessing\process.py", line 315, in _bootstrap
self.run()
File "c:\users\jsl\appdata\local\programs\python\python310\lib\multiprocessing\process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "c:\users\jsl\appdata\local\programs\python\python310\lib\site-packages\uvicorn\subprocess.py", line 76, in subprocess_started
target(sockets=sockets)
File "c:\users\jsl\appdata\local\programs\python\python310\lib\site-packages\uvicorn\server.py", line 68, in run
return asyncio.run(self.serve(sockets=sockets))
File "c:\users\jsl\appdata\local\programs\python\python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "c:\users\jsl\appdata\local\programs\python\python310\lib\asyncio\base_events.py", line 641, in run_until_complete
return future.result()
File "c:\users\jsl\appdata\local\programs\python\python310\lib\site-packages\uvicorn\server.py", line 76, in serve
config.load()
File "c:\users\jsl\appdata\local\programs\python\python310\lib\site-packages\uvicorn\config.py", line 448, in load
self.loaded_app = import_from_string(self.app)
File "c:\users\jsl\appdata\local\programs\python\python310\lib\site-packages\uvicorn\importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "c:\users\jsl\appdata\local\programs\python\python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1049, in _gcd_import
File "<frozen importlib._bootstrap>", line 1026, in _find_and_load
File "<frozen importlib._bootstrap>", line 1005, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 698, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 832, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File ".\main.py", line 1, in <module>
from fastapi import FastAPI
File "c:\users\jsl\appdata\local\programs\python\python310\lib\site-packages\fastapi\__init__.py", line 7, in <module>
from .applications import FastAPI as FastAPI
File "c:\users\jsl\appdata\local\programs\python\python310\lib\site-packages\fastapi\applications.py", line 3, in <module>
from fastapi import routing
File "c:\users\jsl\appdata\local\programs\python\python310\lib\site-packages\fastapi\routing.py", line 20, in <module>
from fastapi import params
File "c:\users\jsl\appdata\local\programs\python\python310\lib\site-packages\fastapi\params.py", line 4, in <module>
from pydantic.fields import FieldInfo, Undefined
File "c:\users\jsl\appdata\local\programs\python\python310\lib\site-packages\pydantic\__init__.py", line 2, in <module>
from . import dataclasses
File "c:\users\jsl\appdata\local\programs\python\python310\lib\site-packages\pydantic\dataclasses.py", line 3, in <module>
from .class_validators import gather_all_validators
File "c:\users\jsl\appdata\local\programs\python\python310\lib\site-packages\pydantic\class_validators.py", line 8, in <module>
from .errors import ConfigError
File "c:\users\jsl\appdata\local\programs\python\python310\lib\site-packages\pydantic\errors.py", line 5, in <module>
from .typing import display_as_type
File "c:\users\jsl\appdata\local\programs\python\python310\lib\site-packages\pydantic\typing.py", line 23, in <module>
from typing_extensions import Annotated, Literal
File "c:\users\jsl\appdata\local\programs\python\python310\lib\site-packages\typing_extensions.py", line 1786, in <module>
#_TypeAliasForm
NameError: name '_TypeAliasForm' is not defined
Related
I am getting this error while running the below command:-
Python version=3.10.8
Django version=2.1
openpyxl=2.6.2
python manage.py runserver 127.0.0.1:8000
Error:-
Exception ignored in thread started by: <function check_errors.<locals>.wrapper at 0x118793400>
Traceback (most recent call last):
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/django/utils/autoreload.py", line 248, in raise_last_exception
raise _exception[1]
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/django/apps/registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/opt/homebrew/Cellar/python#3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/tablib/__init__.py", line 3, in <module>
from tablib.core import (
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/tablib/core.py", line 15, in <module>
from tablib import formats
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/tablib/formats/__init__.py", line 12, in <module>
from . import _xlsx as xlsx
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/tablib/formats/_xlsx.py", line 14, in <module>
import openpyxl
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/openpyxl/__init__.py", line 6, in <module>
from openpyxl.workbook import Workbook
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/openpyxl/workbook/__init__.py", line 5, in <module>
from .workbook import Workbook
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/openpyxl/workbook/workbook.py", line 8, in <module>
from openpyxl.worksheet.worksheet import Worksheet
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/openpyxl/worksheet/worksheet.py", line 30, in <module>
from openpyxl.cell import Cell, MergedCell
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/openpyxl/cell/__init__.py", line 4, in <module>
from .cell import Cell, WriteOnlyCell, MergedCell
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/openpyxl/cell/cell.py", line 52, in <module>
from openpyxl.styles.styleable import StyleableObject
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/openpyxl/styles/styleable.py", line 11, in <module>
from .builtins import styles
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/openpyxl/styles/builtins.py", line 1347, in <module>
('Normal', NamedStyle.from_tree(fromstring(normal))),
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/defusedxml/common.py", line 113, in fromstring
parser = DefusedXMLParser(target=_TreeBuilder(),
File "/Users/chandanvarma/Desktop/project/retailer-backend/venv/lib/python3.10/site-packages/defusedxml/ElementTree.py", line 68, in __init__
_XMLParser.__init__(self, html, target, encoding)
TypeError: XMLParser.__init__() takes 1 positional argument but 4 were given
I couldn't understand the exact issue behind this, If anyone has an idea how to resolve, please feel free share his/her suggestions.
The html argument of XMLParser() is deprecated in python3.7. You must to upgrade openpyxl to a newest version (at least 3.0.0):
https://openpyxl.readthedocs.io/en/stable/changes.html#id80
when i opened jupternotebook in anaconda3, it showed that:
File "C:\ProgramData\Anaconda3\cwp.py", line 9, in <module>
from menuinst.knownfolders import FOLDERID, get_folder_path, PathNotFoundException
File "C:\ProgramData\Anaconda3\lib\site-packages\menuinst\__init__.py", line 23, in <module>
from .win32 import Menu, ShortCut
File "C:\ProgramData\Anaconda3\lib\site-packages\menuinst\win32.py", line 11, in <module>
import pywintypes
File "C:\ProgramData\Anaconda3\lib\site-packages\win32\lib\pywintypes.py", line 2, in <module>
import imp, sys, os
File "C:\ProgramData\Anaconda3\lib\imp.py", line 23, in <module>
from importlib import util
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 857, in get_code
File "<frozen importlib._bootstrap_external>", line 525, in _compile_bytecode
ValueError: bad marshal data (unknown type code)
then i guessed it may be importlib's error but when i wanted to check the version of this package, i found i can't use the command below
PS C:\Users\Jayus> python -m pip list
Could not import runpy module
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\runpy.py", line 15, in <module>
import importlib.util
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 857, in get_code
File "<frozen importlib._bootstrap_external>", line 525, in _compile_bytecode
ValueError: bad marshal data (unknown type code)
PS C:\Users\Jayus> pip list
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\pip-script.py", line 6, in <module>
from pip._internal.cli.main import main
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\cli\main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\cli\autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\cli\main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 19, in <module>
from distutils.util import strtobool
File "C:\ProgramData\Anaconda3\lib\distutils\util.py", line 9, in <module>
import importlib.util
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 857, in get_code
File "<frozen importlib._bootstrap_external>", line 525, in _compile_bytecode
ValueError: bad marshal data (unknown type code)
it clearly is the importlib's error but how can i fix it? I have tried install it in anaconda3 and the pycharm, but i can not even open it, when i use the command below, error again.
PS C:\Users\Jayus> conda activate base
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\_vendor\auxlib\_vendor\five.py", line 47, in <module>
reload = reload # noqa
NameError: name 'reload' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\conda-script.py", line 12, in <module>
sys.exit(main())
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main.py", line 151, in main
from ..exceptions import conda_exception_handler
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\exceptions.py", line 19, in <module>
from ._vendor.auxlib.entity import EntityEncoder
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\_vendor\auxlib\entity.py", line 253, in <module>
from .collection import AttrDict, frozendict, make_immutable
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\_vendor\auxlib\collection.py", line 10, in <module>
from .compat import isiterable, iteritems, odict, text_type
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\_vendor\auxlib\compat.py", line 9, in <module>
from ._vendor.five import WhateverIO as StringIO, with_metaclass
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\_vendor\auxlib\_vendor\five.py", line 49, in <module>
from imp import reload # noqa
File "C:\ProgramData\Anaconda3\lib\imp.py", line 23, in <module>
from importlib import util
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 857, in get_code
File "<frozen importlib._bootstrap_external>", line 525, in _compile_bytecode
ValueError: bad marshal data (unknown type code)
base is my env name, and it is the default env
by the way, i can not open anaconda3 powershell prompt and the navigator, that is the result.
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\_vendor\auxlib\_vendor\five.py", line 47, in <module>
reload = reload # noqa
NameError: name 'reload' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main.py", line 139, in main
from ..activate import main as activator_main
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\activate.py", line 20, in <module>
from ._vendor.auxlib.compat import Utf8NamedTemporaryFile
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\_vendor\auxlib\compat.py", line 9, in <module>
from ._vendor.five import WhateverIO as StringIO, with_metaclass
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\_vendor\auxlib\_vendor\five.py", line 49, in <module>
from imp import reload # noqa
File "C:\ProgramData\Anaconda3\lib\imp.py", line 23, in <module>
from importlib import util
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 857, in get_code
File "<frozen importlib._bootstrap_external>", line 525, in _compile_bytecode
ValueError: bad marshal data (unknown type code)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\_vendor\auxlib\_vendor\five.py", line 47, in <module>
reload = reload # noqa
NameError: name 'reload' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\conda-script.py", line 12, in <module>
sys.exit(main())
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main.py", line 147, in main
init_loggers()
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main.py", line 56, in init_loggers
from ..gateways.logging import initialize_logging, set_verbosity
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\gateways\logging.py", line 14, in <module>
from ..common.io import attach_stderr_handler
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\common\io.py", line 31, in <module>
from .._vendor.auxlib.logz import NullHandler
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\_vendor\auxlib\logz.py", line 9, in <module>
from .compat import text_type
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\_vendor\auxlib\compat.py", line 9, in <module>
from ._vendor.five import WhateverIO as StringIO, with_metaclass
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\_vendor\auxlib\_vendor\five.py", line 49, in <module>
from imp import reload # noqa
File "C:\ProgramData\Anaconda3\lib\imp.py", line 23, in <module>
from importlib import util
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 857, in get_code
File "<frozen importlib._bootstrap_external>", line 525, in _compile_bytecode
ValueError: bad marshal data (unknown type code)
Invoke-Expression : 无法将参数绑定到参数“Command”,因为该参数为空字符串。
所在位置 C:\ProgramData\Anaconda3\shell\condabin\Conda.psm1:101 字符: 36
+ Invoke-Expression -Command $activateCommand;
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Invoke-Expression],ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Invo
keExpressionCommand
i can still use the python command,but that's it,that's all i can use maybe. thank you for all if you can help me.
I solved this, maybe not solve, i just reinstalled it....
when using azure functions I have the problem that certain packages (e.g. azure.kusto.data) can not be installed from the init file.
My init file looks like this:
import datetime
import logging
from azure.kusto.data.helpers import dataframe_from_result_table
import azure.functions as func
def main(mytimer: func.TimerRequest) -> None:
utc_timestamp = datetime.datetime.utcnow().replace(
tzinfo=datetime.timezone.utc).isoformat()
if mytimer.past_due:
logging.info('The timer is past due!')
logging.info('Python timer trigger function ran at %s', utc_timestamp)
My requirements.txt file contains:
azure-functions
azure-kusto-data
The error message is the following:
Result: Failure
Exception: AssertionError:
Stack: File "C:\Users\hanft\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\3.9/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 301, in _handle__function_load_request
func = loader.load_function(
File "C:\Users\hanft\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\3.9/WINDOWS/X64\azure_functions_worker\utils\wrappers.py", line 40, in call
return func(*args, **kwargs)
File "C:\Users\hanft\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\3.9/WINDOWS/X64\azure_functions_worker\loader.py", line 83, in load_function
mod = importlib.import_module(fullmodname)
File "C:\Users\hanft\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
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 "<frozen importlib._bootstrap_external>", line 855, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Users\hanft\Documents\azuretestneu\jobs_creator\__init__.py", line 3, in <module>
from azure.kusto.data.helpers import dataframe_from_result_table
File "C:\Users\hanft\Documents\azuretestneu\.venv\lib\site-packages\azure\kusto\data\__init__.py", line 5, in <module>
from .client import KustoClient, KustoConnectionStringBuilder, ClientRequestProperties
File "C:\Users\hanft\Documents\azuretestneu\.venv\lib\site-packages\azure\kusto\data\client.py", line 22, in <module>
from .security import _AadHelper
File "C:\Users\hanft\Documents\azuretestneu\.venv\lib\site-packages\azure\kusto\data\security.py", line 5, in <module>
from ._token_providers import *
File "C:\Users\hanft\Documents\azuretestneu\.venv\lib\site-packages\azure\kusto\data\_token_providers.py", line 10, in <module>
from azure.identity import ManagedIdentityCredential, AzureCliCredential
File "C:\Users\hanft\Documents\azuretestneu\.venv\lib\site-packages\azure\identity\__init__.py", line 9, in <module>
from ._credentials import (
File "C:\Users\hanft\Documents\azuretestneu\.venv\lib\site-packages\azure\identity\_credentials\__init__.py", line 5, in <module>
from .authorization_code import AuthorizationCodeCredential
File "C:\Users\hanft\Documents\azuretestneu\.venv\lib\site-packages\azure\identity\_credentials\authorization_code.py", line 8, in <module>
from .._internal.aad_client import AadClient
File "C:\Users\hanft\Documents\azuretestneu\.venv\lib\site-packages\azure\identity\_internal\__init__.py", line 50, in <module>
from .certificate_credential_base import CertificateCredentialBase
File "C:\Users\hanft\Documents\azuretestneu\.venv\lib\site-packages\azure\identity\_internal\certificate_credential_base.py", line 11, in <module>
from .persistent_cache import load_service_principal_cache
File "C:\Users\hanft\Documents\azuretestneu\.venv\lib\site-packages\azure\identity\_internal\persistent_cache.py", line 9, in <module>
import msal_extensions
File "C:\Users\hanft\Documents\azuretestneu\.venv\lib\site-packages\msal_extensions\__init__.py", line 12, in <module>
from .cache_lock import CrossPlatLock
File "C:\Users\hanft\Documents\azuretestneu\.venv\lib\site-packages\msal_extensions\cache_lock.py", line 5, in <module>
import portalocker
File "C:\Users\hanft\Documents\azuretestneu\.venv\lib\site-packages\portalocker\__init__.py", line 4, in <module>
from . import portalocker
File "C:\Users\hanft\Documents\azuretestneu\.venv\lib\site-packages\portalocker\portalocker.py", line 10, in <module>
import pywintypes
File "C:\Users\hanft\Documents\azuretestneu\.venv\lib\site-packages\win32\lib\pywintypes.py", line 105, in <module>
__import_pywin32_system_module__("pywintypes", globals())
File "C:\Users\hanft\Documents\azuretestneu\.venv\lib\site-packages\win32\lib\pywintypes.py", line 99, in __import_pywin32_system_module__
assert sys.modules[modname] is not old_mod
When removing the line
from azure.kusto.data.helpers import dataframe_from_result_table
from the init file, everything works fine.
I tried reinstalling python and visual studio code.
Any help would be appreciated!
As the trace suggests, pywin32 is a transitive dependency of azure-identity, an authentication library azure-kusto-data uses (azure-sdk-for-python#19989 has more detail on the problem, if you're curious). The latest version of azure-identity (1.6.1) imports that dependency only when necessary, to implement an optional feature. Happily, azure-kusto-data doesn't use that feature, so you should be able to work around this by upgrading azure-identity.
I built a docker file that installs gdal and proj library on CentOS8.
After successfully installation of all dependencies, when i run my docker image i get OSError: libgdal.so.27: cannot open shared object file: No such file or directory.
Please how do i rectify this ?
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib64/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/devuser/.local/lib/python3.6/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/home/devuser/.local/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 110, in inner_run
autoreload.raise_last_exception()
File "/home/devuser/.local/lib/python3.6/site-packages/django/utils/autoreload.py", line 76, in raise_last_exception
raise _exception[1]
File "/home/devuser/.local/lib/python3.6/site-packages/django/core/management/__init__.py", line 357, in execute
autoreload.check_errors(django.setup)()
File "/home/devuser/.local/lib/python3.6/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/home/devuser/.local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/devuser/.local/lib/python3.6/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/home/devuser/.local/lib/python3.6/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
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 "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/devuser/.local/lib/python3.6/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/home/devuser/.local/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 48, in <module>
class AbstractBaseUser(models.Model):
File "/home/devuser/.local/lib/python3.6/site-packages/django/db/models/base.py", line 122, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/home/devuser/.local/lib/python3.6/site-packages/django/db/models/base.py", line 326, in add_to_class
value.contribute_to_class(cls, name)
File "/home/devuser/.local/lib/python3.6/site-packages/django/db/models/options.py", line 206, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/home/devuser/.local/lib/python3.6/site-packages/django/db/__init__.py", line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/home/devuser/.local/lib/python3.6/site-packages/django/db/utils.py", line 214, in __getitem__
backend = load_backend(db['ENGINE'])
File "/home/devuser/.local/lib/python3.6/site-packages/django/db/utils.py", line 111, in load_backend
return import_module('%s.base' % backend_name)
File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/devuser/.local/lib/python3.6/site-packages/django/contrib/gis/db/backends/postgis/base.py", line 6, in <module>
from .features import DatabaseFeatures
File "/home/devuser/.local/lib/python3.6/site-packages/django/contrib/gis/db/backends/postgis/features.py", line 1, in <module>
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
File "/home/devuser/.local/lib/python3.6/site-packages/django/contrib/gis/db/backends/base/features.py", line 3, in <module>
from django.contrib.gis.db import models
File "/home/devuser/.local/lib/python3.6/site-packages/django/contrib/gis/db/models/__init__.py", line 3, in <module>
import django.contrib.gis.db.models.functions # NOQA
File "/home/devuser/.local/lib/python3.6/site-packages/django/contrib/gis/db/models/functions.py", line 3, in <module>
from django.contrib.gis.db.models.fields import BaseSpatialField, GeometryField
File "/home/devuser/.local/lib/python3.6/site-packages/django/contrib/gis/db/models/fields.py", line 3, in <module>
from django.contrib.gis import forms, gdal
File "/home/devuser/.local/lib/python3.6/site-packages/django/contrib/gis/forms/__init__.py", line 3, in <module>
from .fields import ( # NOQA
File "/home/devuser/.local/lib/python3.6/site-packages/django/contrib/gis/forms/fields.py", line 2, in <module>
from django.contrib.gis.gdal import GDALException
File "/home/devuser/.local/lib/python3.6/site-packages/django/contrib/gis/gdal/__init__.py", line 28, in <module>
from django.contrib.gis.gdal.datasource import DataSource
File "/home/devuser/.local/lib/python3.6/site-packages/django/contrib/gis/gdal/datasource.py", line 39, in <module>
from django.contrib.gis.gdal.driver import Driver
File "/home/devuser/.local/lib/python3.6/site-packages/django/contrib/gis/gdal/driver.py", line 5, in <module>
from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi
File "/home/devuser/.local/lib/python3.6/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 9, in <module>
from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal
File "/home/devuser/.local/lib/python3.6/site-packages/django/contrib/gis/gdal/libgdal.py", line 50, in <module>
lgdal = CDLL(lib_path)
File "/usr/lib64/python3.6/ctypes/__init__.py", line 343, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libgdal.so.27: cannot open shared object file: No such file or directory
What i've tried
DISCLAIMER: I really do not understand why i did all of these and i don't know what they mean. I just want to install gdal for geodjango
RUN echo /usr/local/lib >> /etc/ld.so.conf.d/usrlocal.conf
RUN touch /etc/ld.so.conf.d/libgdal-x86_64.conf
RUN echo "/usr/local/lib" >> /etc/ld.so.conf.d/libgdal-x86_64.conf
Django recommends doing this
RUN export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
I'm attempting to set up a celery daemon to run on server boot with a Django REST server (should note as well that I'm doing this all within a Vagrant VM). I've followed several tutorials online (including those provided by Celery) and still cannot get this to work.
Config:
CELERYD_NODES="celery_worker"
CELERY_BIN="/usr/local/bin/celery"
CELERY_APP="proj"
CELERYD_CHDIR="/vagrant/proj/"
CELERYD_LOG_FILE="/var/log/celery/%N.log"
CELERYD_PID_FILE="/var/run/celery/%N.pid"
CELERYD_USER="celery"
CELERYD_GROUP="celery"
CELERY_CREATE_DIRS=1
proj/proj/celery.py:
from __future__ import absolute_import
import os
from celery import Celery
from django.conf import settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings')
app = Celery('proj')
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
#app.task(bind=True)
def debug_task(self):
print('Request: {0!r}'.format(self.request))
proj/proj/__init__.py:
from __future__ import absolute_import
from proj.celery import app as celery_app
In my boot log, I get this error:
Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.4/dist-packages/celery/__main__.py", line 54, in <module>
main()
File "/usr/local/lib/python3.4/dist-packages/celery/__main__.py", line 30, in main
main()
File "/usr/local/lib/python3.4/dist-packages/celery/bin/celery.py", line 81, in main
cmd.execute_from_commandline(argv)
File "/usr/local/lib/python3.4/dist-packages/celery/bin/celery.py", line 793, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "/usr/local/lib/python3.4/dist-packages/celery/bin/base.py", line 309, in execute_from_commandline
argv = self.setup_app_from_commandline(argv)
File "/usr/local/lib/python3.4/dist-packages/celery/bin/base.py", line 469, in setup_app_from_commandline
self.app = self.find_app(app)
File "/usr/local/lib/python3.4/dist-packages/celery/bin/base.py", line 489, in find_app
return find_app(app, symbol_by_name=self.symbol_by_name)
File "/usr/local/lib/python3.4/dist-packages/celery/app/utils.py", line 235, in find_app
sym = symbol_by_name(app, imp=imp)
File "/usr/local/lib/python3.4/dist-packages/celery/bin/base.py", line 492, in symbol_by_name
return symbol_by_name(name, imp=imp)
File "/usr/local/lib/python3.4/dist-packages/kombu/utils/__init__.py", line 96, in symbol_by_name
module = imp(module_name, package=package, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/celery/utils/imports.py", line 101, in import_from_cwd
return imp(module, package=package)
File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
ImportError: No module named 'proj'
I cannot seem to get past this error despite having everything exactly the same as the Celery docs seem to want it. Any help out there?