Airflow No module named 'wtforms.compat' - python-3.x

recently i have been trying to install airflow on my Macbook pro( 2 GHz Quad-Core Intel Core i5)
However, i have been facing persistent problems in trying to create a virtual environment(venv) where i can install airflow.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/bin/airflow", line 26, in <module>
from airflow.bin.cli import CLIFactory
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airflow/bin/cli.py", line 82, in <module>
from airflow.www.app import (cached_app, create_app)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airflow/www/app.py", line 42, in <module>
from airflow.www.blueprints import routes
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airflow/www/blueprints.py", line 25, in <module>
from airflow.www import utils as wwwutils
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airflow/www/utils.py", line 36, in <module>
from wtforms.compat import text_type
ModuleNotFoundError: No module named 'wtforms.compat'
System Description:
1.Macbook pro( 2 GHz Quad-Core Intel Core i5)
2.Python Version (3.8.12)
Possible solutions:
I have installed airflow in accordance to the documentation
pip install "apache-airflow[celery]==2.2.3" --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.2.3/constraints-3.8.txt"
I have tried most solutions here as well as airflow github issues. Most recommend reinstalling which i did as well. Some include changing wtforms == 2.3.3 but to no avail as well.
I have exhuasted most of my means i hope stackoverflow can guide me through this. Lastly, thank you in advance and i hope to learn from you

You are using Python 3.9 not python 3.8
File "/Library/Frameworks/Python.framework/Versions/3.9/bin/airflow", line 26, in <module>
Apparently for some reason you mixed those. You should make sure you both CREATE and ACTIVATE virtualenv and install airflow in the right virtualenv.

Related

ModuleNotFoundError: No module named 'six' - python 3.8.5

When trying to open jupyter notebook from my terminal in Visual Studio Code, I keep getting the error below. I have tried uninstalling and reinstalling six using conda install but the same issue persists. It was working fine yesterday so I don't know what happened between now and then. I'm using Python 3.8.5 in my virtual environment. Any ideas what could be the issue?
(dreams) C:\Users\jacks\Documents\dreams_project>jupyter notebook
Traceback (most recent call last):
File "C:\Users\jacks\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Users\jacks\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 83, in <module>
from .services.kernels.kernelmanager import MappingKernelManager, AsyncMappingKernelManager
File "C:\Users\jacks\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 18, in <module>
from jupyter_client.session import Session
File "C:\Users\jacks\Anaconda3\lib\site-packages\jupyter_client\session.py", line 41, in <module>
from jupyter_client.jsonutil import extract_dates, squash_dates, date_default
File "C:\Users\jacks\Anaconda3\lib\site-packages\jupyter_client\jsonutil.py", line 10, in <module>
from dateutil.parser import parse as _dateutil_parse
File "C:\Users\jacks\Anaconda3\lib\site-packages\dateutil\parser\__init__.py", line 2, in <module>
from ._parser import parse, parser, parserinfo, ParserError
File "C:\Users\jacks\Anaconda3\lib\site-packages\dateutil\parser\_parser.py", line 42, in <module>
import six
ModuleNotFoundError: No module named 'six'
I had the same issue, six was showing as installed by conda and loading fine when imported manually in python. The base version of Jupyter Notebook would load, but Jupyter Notebook wouldn't load in my virtual environment.
Running pip3 install six from a terminal with my environment activated seemed to solve the issue but I don't know why!
Also make sure the path to Conda in the VS Python extension settings is correct.

distutils.util missing after upgrading to 3.8

I just upgraded to Pop OS(Ubuntu) 20.04, which upgraded Python 3.7 to 3.8. Now I get this error below when I run sam (from the AWS SAM CLI). Solutions found online all had to do with making sure python3-distutils is installed. I have verified that python3-disutils is installed. /usr/lib/python3.8/distutils looks fine, just not getting picked up for some reason.
One thing I noticed is that in the traceback below, it's using the system-wide pip, while I have a later version of pip installed under my .local. I don't know if those two symptoms are related but looks like I'm missing some config somewhere so none of the 3.8 or user space stuff is picked up.
Build Failed
Error: PythonPipBuilder:ResolveDependencies - Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3/dist-packages/pip/_internal/main.py", line 14, in main
from pip._internal.utils.entrypoints import _wrapper
File "/usr/lib/python3/dist-packages/pip/_internal/utils/entrypoints.py", line 3, in <module>
from pip._internal.cli.main import main
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 19, in <module>
from distutils.util import strtobool
ModuleNotFoundError: No module named 'distutils.util'
I have the same issue on Debian Bullseye (or rather mixed Bullseye/Buster).
Package python3-distutils (3.8.6) contains module for Python 3.8 and 3.9 (!).
Old package (3.7.3) for Python 3.7. You have to choose.
My workaround is just copy module.
mkdir -p /usr/lib/python3.7/distutils
cp -a /usr/lib/python3.8/distutils/* /usr/lib/python3.7/distutils/

TensorFlow-GPU 1.12.0 + CUDA 9 + cuDNN 7.41 on Windows throws DLL load failed. Same bundle works on Ubuntu

As in title I have
CUDA 9.0.176
cuDNN v7.4.1
TF-GPU 1.12
Python 3.6.6
I can confirm that path both to bin/lib for CUDA is in a PATH and also there is a path to cuda folder (not sure why if same files were copieed to CUDA folder (nvidia not a custom one as per tutorials)).
import tensorflow
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\OtherCode\Teest1\test1\lib\site-
packages\tensorflow\__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint:
disable=unused-import
File "D:\OtherCode\Teest1\test1\lib\site-
packages\tensorflow\python\__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "D:\OtherCode\Teest1\test1\lib\site-
packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
File "D:\OtherCode\Teest1\test1\lib\site-
packages\google\protobuf\descriptor.py", line 47, in <module>
from google.protobuf.pyext import _message
ImportError: DLL load failed: The specified procedure could not be found.
I've tried pretty much many other different bundles after that (using Tensorflow table showing tested configurations), but none of them works.
I have all files in System32 that I've found info about, I have VS 2017 / 2019 + install the compile for 2015.
Nothing works.
Is there anything on Windows that I need to be aware of ?
Same bundle works fine on Ubuntu pretty much instantly, on Windows it fails terribly.
I would prefer use windows as there is number of issues with ubuntu (most of hardware is not supported on Ubuntu + I am using VS Studio for most of the projects).
I've tried CUDA 8.0, CUDA 9.0, CUDA 9.2, CUDA 10 (with different cuDNN for specific version + different tensorflows according to the table, however it looks like there is something else missing).
Unfortunately for some reason this combo won't work.
Other with CUDA 10 worked.

Unable to get to Jupiter Notebook and Jsonschema Missing

I have been solving issues with my MacBook Air for the past day and I have unfortunately again bumped into some more issues. You might have seen this question before, but I couldn't solve this issue after trying all answers from
Can't use Jupyter Notebook: jsonschema apparently missing
Basically, I am now trying to enter Jupyter Notebook. I (think I) have two of them, one Jupyter Notebook installed using pip3 (Python 3.6.0), and one from Anaconda, which I uninstalled. For Anaconda, although I used anaconda clean and the rm function according to their official website and several other Stack Overflow forums, I could not uninstall the BASH and so I just left it there and installed Jupyter Notebook using pip3. But when I type Jupyter Notebook in Terminal, there is an error:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nbformat/validator.py", line 12, in <module>
from jsonschema import ValidationError
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/jsonschema/__init__.py", line 32, in <module>
from pkg_resources import get_distribution
ImportError: cannot import name 'get_distribution'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/bin/jupyter-notebook", line 6, in <module>
from notebook.notebookapp import main
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/notebookapp.py", line 83, in <module>
from .services.contents.manager import ContentsManager
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/services/contents/manager.py", line 17, in <module>
from nbformat import sign, validate as validate_nb, ValidationError
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nbformat/__init__.py", line 33, in <module>
from .validator import validate, ValidationError
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nbformat/validator.py", line 23, in <module>
raise ImportError(str(e) + verbose_msg)
ImportError: cannot import name 'get_distribution'
Jupyter notebook format depends on the jsonschema package:
https://pypi.python.org/pypi/jsonschema
Please install it first.
What I am using:
MacOS High Sierra 10.13.6
Macbook Air 2011 i7 4gb ram
Python 3.6.0 (pip3 to install Jupyter)
What I have installed in Python: Numpy, Pandas, Tensorflow, Keras
Thank you for helping! Please point out any errors or ways I can improve this question if possible. Also, try to answer solutions differently from Can't use Jupyter Notebook: jsonschema apparently missing .

Yaml with Python 3

I have a python3.6 virtual environment. I an trying to run some keras code and came across this error:
Traceback (most recent call last):
File "test.py", line 4, in <module>
from keras import backend as K
File "Keras-2.0.8/keras/__init__.py", line 4, in <module>
from . import activations
File "Keras-2.0.8/keras/activations.py", line 6, in <module>
from .engine import Layer
File "Keras-2.0.8/keras/engine/__init__.py", line 3, in <module>
from .topology import InputSpec
File "Keras-2.0.8/keras/engine/topology.py", line 8, in <module>
import yaml
File "Keras-2.0.8/yaml/__init__.py", line 2, in <module>
from error import *
ModuleNotFoundError: No module named 'error'
I saw a few other posts regarding this but those all suggest that the problems may be that I am using the python 2.7 version for python3. However, I don not think this is the case since I am in a python 3.6 virtual environment.
I also saw some comments about re-installing/upgrading yaml with python3.6 specifically. I thought doing a pip install in the virtual environment would fix this but it did not seem to help. Any suggestions regarding how to resolve this issue would be much appreciated.
Side Note: the code I am trying to run is test.py from this repo when I come across the error.

Resources