I was trying to import excel file into python, here is my code :
import pandas as pd
df = pd.read_excel('Sales.xlsx')
print(df)
somehow, i get a list of error and i have no idea how to fix it
Traceback (most recent call last):
File "C:\Users\wongs\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\compat\_optional.py", line 141, in import_optional_dependency
module = importlib.import_module(name)
File "C:\Users\wongs\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'openpyxl'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\wongs\OneDrive\Desktop\utar\y2s3\data mining\P2 TASK 3.py", line 3, in <module>
df = pd.read_excel('Sales.xlsx')
File "C:\Users\wongs\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\util\_decorators.py", line 211, in wrapper
return func(*args, **kwargs)
File "C:\Users\wongs\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\util\_decorators.py", line 331, in wrapper
return func(*args, **kwargs)
File "C:\Users\wongs\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\io\excel\_base.py", line 482, in read_excel
io = ExcelFile(io, storage_options=storage_options, engine=engine)
File "C:\Users\wongs\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\io\excel\_base.py", line 1695, in __init__
self._reader = self._engines[engine](self._io, storage_options=storage_options)
File "C:\Users\wongs\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\io\excel\_openpyxl.py", line 556, in __init__
import_optional_dependency("openpyxl")
File "C:\Users\wongs\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\compat\_optional.py", line 144, in import_optional_dependency
raise ImportError(msg)
ImportError: Missing optional dependency 'openpyxl'. Use pip or conda to install openpyxl.
Your code is fine but there is openpyxl package missing.
Install it using command : !pip install openpyxl
run the above command in your command prompt and then run your code hope it will work fine.
Related
When i import modules from pip, like requests i get this error when running in VSCODE:
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: C:\Users\user\AppData\Local\Temp\tmp_6yww79s
The only code I used was:
import requests
I get the same error if i check pip version in terminal or other commands with pip:
pip --version
Full error:
PS C:\Script\Frost_met> & 'C:\Users\jrf\AppData\Local\Programs\Python\Python310\python.exe' 'c:\Users\jrf\.vscode\extensions\ms-python.python-2022.12.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '62406' '--' 'c:\Script\Frost_met\frost.py'
Traceback (most recent call last):
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 89, in _tempfile
os.write(fd, reader())
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\importlib\abc.py", line 371, in read_bytes
with self.open('rb') as strm:
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\importlib\_adapters.py", line 54, in open
raise ValueError()
ValueError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Script\Frost_met\frost.py", line 4, in <module>
import requests
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\__init__.py", line 147, in <module>
from . import packages, utils
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\utils.py", line 24, in <module>
from . import certs
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\certs.py", line 14, in <module>
from certifi import where
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 "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 177, in _exec_module
notify_module_loaded(module)
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi_win32\wrapt_certifi.py", line 20, in apply_patches
certifi_win32.wincerts.CERTIFI_PEM = certifi.where()
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi\core.py", line 37, in where
_CACERT_PATH = str(_CACERT_CTX.__enter__())
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 95, in _tempfile
os.remove(raw_path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\jrf\\AppData\\Local\\Temp\\tmp23ldltgt'
PS C:\Script\Frost_met>
PS C:\Script\Frost_met> & 'C:\Users\jrf\AppData\Local\Programs\Python\Python310\python.exe' 'c:\Users\jrf\.vscode\extensions\ms-python.python-2022.12.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '62406' '--' 'c:\Script\Frost_met\frost.py'
Traceback (most recent call last):
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 89, in _tempfile
os.write(fd, reader())
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\importlib\abc.py", line 371, in read_bytes
with self.open('rb') as strm:
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\importlib\_adapters.py", line 54, in open
raise ValueError()
ValueError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Script\Frost_met\frost.py", line 4, in <module>
import requests
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\__init__.py", line 147, in <module>
from . import packages, utils
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\utils.py", line 24, in <module>
from . import certs
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\certs.py", line 14, in <module>
from certifi import where
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 "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 177, in _exec_module
notify_module_loaded(module)
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi_win32\wrapt_certifi.py", line 20, in apply_patches
certifi_win32.wincerts.CERTIFI_PEM = certifi.where()
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi\core.py", line 37, in where
_CACERT_PATH = str(_CACERT_CTX.__enter__())
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Users\jrf\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 95, in _tempfile
os.remove(raw_path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\jrf\\AppData\\Local\\Temp\\tmp23ldltgt'
PS C:\Script\Frost_met>
Looks like the problem comes from python-certifi-win32, as seen in the error messages. To solve it use the link below there are solutions for python-certifi-win32 problem.
python-certifi-win32 problem with solutions
If these solutions don't work search for python-certifi-win32 uninstall and install process.
Last but not recommended solution uninstall all python files and libraries delete config files, caches and all files related to python and reinstall.
I was running into the same problem, but the error was intermittent. If you are coding your file open/close correctly and still running into this error, make sure you are not synching the files with Dropbox, Google Drive, etc. I paused Dropbox and I no longer see the error.
I installed python-certifi-win32 package and after that, I am getting below error, when I import anything or pip install anything, the fail with the final error of PermissionError.
I tried rebooting the box. It didn't work. I am unable to uninstall the package as pip is erroring out too.
I am unable to figure out the exact reason why this error is happening. It doesn't seem to be code specific, seems related to the library I installed
PS C:\Users\visha\PycharmProjects\master_test_runner> pip install python-certifi-win32
Traceback (most recent call last):
File "C:\Users\visha\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 89, in _tempfile
os.write(fd, reader())
File "C:\Users\visha\AppData\Local\Programs\Python\Python310\lib\importlib\abc.py", line 371, in read_bytes
with self.open('rb') as strm:
File "C:\Users\visha\AppData\Local\Programs\Python\Python310\lib\importlib\_adapters.py", line 54, in open
raise ValueError()
ValueError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\visha\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\visha\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\Scripts\pip.exe\__main__.py", line 4, in <module>
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\pip\_internal\cli\main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\pip\_internal\cli\parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\pip\_internal\configuration.py", line 21, in <module>
from pip._internal.exceptions import (
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\pip\_internal\exceptions.py", line 8, in <module>
from pip._vendor.requests.models import Request, Response
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\pip\_vendor\requests\__init__.py", line 123, in <module>
from . import utils
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\pip\_vendor\requests\utils.py", line 25, in <module>
from . import certs
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 "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\wrapt\importer.py", line 170, in exec_module
notify_module_loaded(module)
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\certifi_win32\wrapt_pip.py", line 35, in apply_patches
import certifi
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 "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\wrapt\importer.py", line 170, in exec_module
notify_module_loaded(module)
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\certifi_win32\wrapt_certifi.py", line 20, in apply_patches
certifi_win32.wincerts.CERTIFI_PEM = certifi.where()
File "C:\Users\visha\PycharmProjects\GUI_Automation\venv\lib\site-packages\certifi\core.py", line 37, in where
_CACERT_PATH = str(_CACERT_CTX.__enter__())
File "C:\Users\visha\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Users\visha\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 95, in _tempfile
os.remove(raw_path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\visha\\AppData\\Local\\Temp\\tmpy_tb8siv'
PS C:\Users\visha\PycharmProjects\master_test_runner>
I ran into the same issue today. I corrected it by removing two *.pth files that were created when I had installed python-certifi-win32. This prevents python-certifi-win32 from loading when python is run.
The files are listed below, and were located here:
C:\Users\<username>\AppData\Local\Programs\Python\Python310\Lib\site-packages
Files:
python-certifi-win32-init.pth
distutils-precedence.pth
Removing these files allowed me to install/uninstall other modules.
Andrew Leech, the author of python-certifi-win32, suggests to move on to his other project pip-system-certs (PyPI link). Drop-in replacing python-certifi-win32 with pip-system-certs solved all issues for me.
While the solution provided in this answer prevented the in the question mentioned error message for me too, it came with the side effect that my Python script didn't use the certificates in the Windows certificate store anymore, resulting again in SSL certificate errors - rendering the use of the library useless.
I built a new environment in conda using the following .yml file:
name: py37 channels:
conda-forge
defaults dependencies:
python=3.7.7
cartopy=0.18.0
earthengine-api=0.1.221
flake8=3.8.1
jupyterlab=2.1.2
jupyter_contrib_nbextensions=0.5.1
matplotlib=3.2.1
mypy=0.770
nb_conda=2.2.1 # optional, useful for running R in Jupyter notebooks
numpy=1.18.4
pandas=1.0.3
pillow=7.1.2
scikit-learn=0.23.0
scipy=1.4.1
seaborn=0.10.1
tqdm=4.46.0
tensorflow=1.15.0 # only supports up to Python 3.7
I am now running the following section in a .ipynb file
from pprint import pprint import os import sys
import matplotlib.pyplot as plt import numpy as np import pandas as pd import tensorflow as tf
sys.path.append('../') from preprocessing.helper import get_first_feature_map, get_feature_types from utils.geo_plot import setup_ax
I keep getting the following error:
Error in callback <bound method AutoreloadMagics.post_execute_hook of <autoreload.AutoreloadMagics object at 0x7fba286b3a50>> (for post_execute): Traceback (most recent call last): File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/IPython/core/events.py", line 89, in trigger
func(*args, **kwargs) File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/IPython/extensions/autoreload.py", line 538, in post_execute_hook
_, pymtime = self._reloader.filename_and_mtime(sys.modules[modname]) File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/IPython/extensions/autoreload.py", line 184, in filename_and_mtime
if not hasattr(module, '__file__') or module.__file__ is None: File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/tensorflow/__init__.py", line 50, in __getattr__
module = self._load() File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/tensorflow/__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__) File "/Users/prernamishra/opt/miniconda3/envs/py37/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 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 "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/tensorflow_core/contrib/__init__.py", line 39, in <module>
from tensorflow.contrib import compiler File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/tensorflow_core/contrib/compiler/__init__.py", line 21, in <module>
from tensorflow.contrib.compiler import jit File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/tensorflow_core/contrib/compiler/__init__.py", line 22, in <module>
from tensorflow.contrib.compiler import xla File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/tensorflow_core/contrib/compiler/xla.py", line 22, in <module>
from tensorflow.python.estimator import model_fn as model_fn_lib File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/tensorflow_core/python/estimator/model_fn.py", line 26, in <module>
from tensorflow_estimator.python.estimator import model_fn File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/model_fn.py", line 29, in <module>
from tensorflow.python.types import core ModuleNotFoundError: No module named 'tensorflow.python.types'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 2077, in showtraceback
stb = value._render_traceback_() AttributeError: 'ModuleNotFoundError' object has no attribute '_render_traceback_'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/IPython/core/ultratb.py", line 1101, in get_records
return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset) File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/IPython/core/ultratb.py", line 248, in wrapped
return f(*args, **kwargs) File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/IPython/core/ultratb.py", line 281, in _fixed_getinnerframes
records = fix_frame_records_filenames(inspect.getinnerframes(etb, context)) File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/inspect.py", line 1502, in getinnerframes
frameinfo = (tb.tb_frame,) + getframeinfo(tb, context) File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/inspect.py", line 1460, in getframeinfo
filename = getsourcefile(frame) or getfile(frame) File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/inspect.py", line 696, in getsourcefile
if getattr(getmodule(object, filename), '__loader__', None) is not None: File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/inspect.py", line 733, in getmodule
if ismodule(module) and hasattr(module, '__file__'): File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/tensorflow/__init__.py", line 50, in __getattr__
module = self._load() File "/Users/prernamishra/opt/miniconda3/envs/py37/lib/python3.7/site-packages/tensorflow/__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__) File "/Users/prernamishra/opt/miniconda3/envs/py37/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 965, in _find_and_load_unlocked ModuleNotFoundError: No module named 'tensorflow_core.estimator'
Do I need to install anything else? The original yml file had - tensorflow==1.15.0 but I changed it because I am running it on a mac and that wasn't working.
Any help is appreciated!
Can you please upgrade to tensorflow 2.c [2.7] and ensure python and OS is 64 bits.
Can you also try:
pip install --upgrade pip
pip uninstall tensorflow
pip install tensorflow
If the error persist:
Create an virtual environment
cd <your project path>
Install virtualenv
pip install virtualenv
Create the virtual environment
virtualenv <envname>
Activate the env
Windows Powershell: .<envname>\Scripts\activate
Unix with Bash or zsh: source /bin/activate
Then now you install tensorflow
(<envname>) $ pip install tensorflow
And then run Hello World successfully.
*Don't forget that you need to activate or configure everytime the virtual environment jupyter, command-line, etc.
while running python manage.py runserver , getting this error as given below. using pycharm
(venv) C:\Users\User\PycharmProjects\PyShop>python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\User\PycharmProjects\PyShop\venv\lib\site-packages\django\template\utils.py",
line 66, in __getitem__
return self._engines[alias]
KeyError: 'django'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\PycharmProjects\PyShop\venv\lib\site-packages\django\template\backends\d
jango.py", line 121, in get_package_libraries
module = import_module(entry[1])
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py", li
ne 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 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 "C:\Users\User\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\templ
atetags\admin_static.py", line 5, in <module>
from django.utils.deprecation import RemovedInDjango30Warning
ImportError: cannot import name 'RemovedInDjango30Warning' from 'django.utils.deprecation' (C:
\Users\User\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\deprecation.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 917, i
n _bootstrap_inner
self.run()
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 865, i
n run
self._target(*self._args, **self._kwargs)
File "C:\Users\User\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\autoreload.py
", line 53, in wrapper
fn(*args, **kwargs)
File "C:\Users\User\PycharmProjects\PyShop\venv\lib\site-packages\django\core\management\com
mands\runserver.py", line 118, in inner_run
self.check(display_num_errors=True)
File "C:\Users\User\PycharmProjects\PyShop\venv\lib\site-packages\django\core\management\bas
e.py", line 396, in check
databases=databases,
File "C:\Users\User\PycharmProjects\PyShop\venv\lib\site-packages\django\core\checks\registr
y.py", line 70, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "C:\Users\User\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\check
s.py", line 78, in check_dependencies
for engine in engines.all():
File "C:\Users\User\PycharmProjects\PyShop\venv\lib\site-packages\django\template\utils.py",
line 90, in all
return [self[alias] for alias in self]
File "C:\Users\User\PycharmProjects\PyShop\venv\lib\site-packages\django\template\utils.py",
line 90, in <listcomp>
return [self[alias] for alias in self]
File "C:\Users\User\PycharmProjects\PyShop\venv\lib\site-packages\django\template\utils.py",
line 81, in __getitem__
engine = engine_cls(params)
File "C:\Users\User\PycharmProjects\PyShop\venv\lib\site-packages\django\template\backends\d
jango.py", line 25, in __init__
options['libraries'] = self.get_templatetag_libraries(libraries)
File "C:\Users\User\PycharmProjects\PyShop\venv\lib\site-packages\django\template\backends\d
jango.py", line 43, in get_templatetag_libraries
libraries = get_installed_libraries()
File "C:\Users\User\PycharmProjects\PyShop\venv\lib\site-packages\django\template\backends\d
jango.py", line 108, in get_installed_libraries
for name in get_package_libraries(pkg):
File "C:\Users\User\PycharmProjects\PyShop\venv\lib\site-packages\django\template\backends\d
jango.py", line 125, in get_package_libraries
"trying to load '%s': %s" % (entry[1], e)
django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportErro
r raised when trying to load 'django.contrib.admin.templatetags.admin_static': cannot import n
ame 'RemovedInDjango30Warning' from 'django.utils.deprecation' (C:\Users\User\PycharmProjects\
PyShop\venv\lib\site-packages\django\utils\deprecation.py)
This is caused by django versions. You probably upgraded it or something
There is a conflicts in Django versions as you can see in your error
ImportError: cannot import name 'RemovedInDjango30Warning'
So you can try to create a virtual environment and first uninstall and then re install
pip uninstall django
and then install another version lower then 3.0
pip install django==2.2
Installed dagster for the first time in a conda environment and tried to run the airline demo as described here. The following are the steps I followed.
conda env create -n dagster python=3.7
conda activate dagster
pip install dagster dagit
git clone git#github.com/dagster-io/dagster.git
cd dagster/examples
pip install -e '[.full]'
docker-compose up -d
cd dagster_examples/airline_demo
dagit
I then get the following stack trace ending in the 'dagster.core.types.runtime' is not a package message:
Loading repository...
Traceback (most recent call last):
File "/Users/timrozmajzl/miniconda3/envs/dagster/bin/dagit-cli", line 8, in <module>
sys.exit(main())
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagit/cli.py", line 110, in main
cli = create_dagit_cli()
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagit/cli.py", line 21, in create_dagit_cli
return ui(auto_envvar_prefix='DAGIT') # pylint: disable=no-value-for-parameter
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagit/cli.py", line 72, in ui
host_dagit_ui(handle, host, port, storage_fallback, reload_trigger)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagit/cli.py", line 81, in host_dagit_ui
app = create_app(handle, instance, reloader)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagit/app.py", line 160, in create_app
version=__version__,
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagster_graphql/implementation/context.py", line 17, in __init__
self.repository_definition = self.get_handle().build_repository_definition()
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagster/core/definitions/handle.py", line 392, in build_repository_definition
obj = self.entrypoint.perform_load()
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagster/core/definitions/handle.py", line 445, in entrypoint
return self.data.get_repository_entrypoint(from_handle=self)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagster/core/definitions/handle.py", line 522, in get_repository_entrypoint
return LoaderEntrypoint.from_yaml(self.repository_yaml, from_handle=from_handle)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagster/core/definitions/handle.py", line 175, in from_yaml
return LoaderEntrypoint.from_module_target(module_name, fn_name, from_handle)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagster/core/definitions/handle.py", line 161, in from_module_target
module = importlib.import_module(module_name)
File "/Users/timrozmajzl/miniconda3/envs/dagster/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 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 "/Users/timrozmajzl/Projects/dagster/dagster/examples/dagster_examples/airline_demo/repository.py", line 3, in <module>
from .pipelines import define_airline_demo_ingest_pipeline, define_airline_demo_warehouse_pipeline
File "/Users/timrozmajzl/Projects/dagster/dagster/examples/dagster_examples/airline_demo/pipelines.py", line 14, in <module>
from .resources import postgres_db_info_resource, redshift_db_info_resource
File "/Users/timrozmajzl/Projects/dagster/dagster/examples/dagster_examples/airline_demo/resources.py", line 3, in <module>
from .types import DbInfo
File "/Users/timrozmajzl/Projects/dagster/dagster/examples/dagster_examples/airline_demo/types.py", line 8, in <module>
from dagster.core.types.runtime.runtime_type import create_string_type
ModuleNotFoundError: No module named 'dagster.core.types.runtime.runtime_type'; 'dagster.core.types.runtime' is not a package
Thanks for reporting this issue! After some digging, it seems like this commit was not compatible with the latest release of dagster (at the time) which caused the error.
Re-running this workflow with the most recent dagster master and dependencies should resolve this. Opening an issue here to track a more long-term fix.
More details: In this commit, 'create_string_type' is introduced to both 'examples/dagster_examples/airline_demo/types.py' and 'python_modules/dagster/dagster/core/types/runtime/runtime_type.py'. However, based on the commands pasted in the question and present in the airline demo steps, airline_demo pipeline was running the tip of master (which contained 'create_string_type') with an older dagster package (from the latest release, which did not contain 'create_string_type').