unable to start Airflow webserver with python 3.10 - python

I installed python 3.10, airflow version 2.2.0
but when I tried to run cmd : airflow webserver
I got :
C:\Users\*\AppData\Local\Programs\Python\Python310\lib\site-packages\airflow\configuration.py:270: DeprecationWarning: The distutils package is deprecated and
slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils.version import StrictVersion
WARNING:root:OSError while attempting to symlink the latest log directory
ModuleNotFoundError: No module named 'pwd'
how I can use these setuptools ?

Please take a look at this link.
http://airflow.apache.org/docs/apache-airflow/stable/installation/prerequisites.html
Airflow 2.2 is not certified to run on python 3.10

Related

No module named 'psutil', although it is installed (MacOS)

When I run my code that includes psutil module I encounter the following error:
Traceback (most recent call last):
File "/Users/alek/Desktop/coloring/solver.py", line 4, in <module>
from psutil import cpu_count
ModuleNotFoundError: No module named 'psutil'
Although, when trying to install the module in terminal, I can see the following
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Requirement already satisfied: psutil in /opt/homebrew/lib/python3.9/site-packages (5.9.1)
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
WARNING: There was an error checking the latest version of pip.
How should I ensure that the module is in the right environment and can be used by my program?
Thanks in advance!
try to upgrade it
sudo pip install --upgrade psutil
try to run this command in python shell:
import site
site.getsitepackages()
actually, it is trying to search psutil module in one of the Xcode path.
see if you have psutil in this path:
/Applications/Xcode_13.4.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages
if not add the psutil module here and it should work.
it worked for me.

"ImportError: pyutilib.enum has been removed" when importing Pyomo on Python 3

While trying to run a barebones Python script that imports Pyomo 5.4.3,
from pyomo.environ import *
or
from pyomo.core import *
I get the error
ImportError: pyutilib.enum has been removed.
Python 3 now has an enum implementation in the standard library (also
available for older Python versions as the third-party enum34 PyPI
package) that supersedes this library.
When installing pyomo in a newly created Conda environment using
conda install -c conda-forge pyomo
I get the following messages
The following NEW packages will be INSTALLED:
appdirs conda-forge/noarch::appdirs-1.4.4-pyh9f0ad1d_0
nose conda-forge/noarch::nose-1.3.7-py_1006
ply conda-forge/noarch::ply-3.11-py_1
pyomo conda-forge/osx-64::pyomo-5.4.3-py36_0
python_abi conda-forge/osx-64::python_abi-3.6-2_cp36m
pyutilib conda-forge/noarch::pyutilib-6.0.0-pyh9f0ad1d_0
six conda-forge/noarch::six-1.16.0-pyh6c4a22f_0
The following packages will be SUPERSEDED by a higher-priority channel:
ca-certificates pkgs/main::ca-certificates-2022.2.1-h~ --> conda-forge::ca-certificates-2021.10.8-h033912b_0
certifi pkgs/main::certifi-2021.10.8-py39hecd~ --> conda-forge::certifi-2016.9.26-py36_0
openssl pkgs/main::openssl-1.1.1n-hca72f7f_0 --> conda-forge::openssl-1.1.1l-h0d85af4_0
pip pkgs/main::pip-21.2.4-py39hecd8cb5_0 --> conda-forge::pip-20.0.2-py36_1
setuptools pkgs/main::setuptools-58.0.4-py39hecd~ --> conda-forge::setuptools-49.6.0-py36h79c6626_3
The following packages will be DOWNGRADED:
python 3.9.7-h88f2d9e_1 --> 3.6.13-h88f2d9e_0
Is there a way to solve this problem and get Pyomo working in my Python 3 environment? I am running this on Mac OS X 12 Monterey. Thanks!
This error is also happening on Python 2.7 and Pyomo 5.4.3!
ImportError: pyomo.environ failed to import pyomo.opt.plugins:
Original ImportError: pyutilib.enum has been removed.
Python 3 now has an enum implementation in the standard library (also
available for older Python versions as the third-party enum34 PyPI
package) that supersedes this library.
Strangely, it talks about Python 3, but we are now in a Python 2 environment!
$ python --version
Python 2.7.18 :: Anaconda, Inc.

No module named 'asgiref.base_layer'

When starting my server (python manage.py run server) I get the following error.
File "/Users/thomasallen/PycharmProjects/Channels_and_Signals/venv/lib/python3.9/site-packages/asgi_redis/core.py", line 19, in
from asgiref.base_layer import BaseChannelLayer
ModuleNotFoundError: No module named 'asgiref.base_layer'
The offending line 19 in .../core.py is
from asgiref.base_layer import BaseChannelLayer
The packages I have installed are:
Django 3.2.4
channels 3.0.3
channels-redid 3.2.0
aspired 3.3.4
asgi-redis 1.1.0
I'm not sure where the mismatch is.
It's because asgi_redis 1.1.0 depends on an old version of asgiref (listed without an upper bound as asgiref>=1.0.0 in their setup.py) which used to have this code. But you have a more recent version installed because Django depends on asgiref >= 3.3.2.
You shouldn't have both asgi_redis and channels_redis installed, they are different versions of the same package. See note in the channels_redis git repo:
Note: Prior versions of this package were called asgi_redis and are still available under PyPI as that name if you need them for Channels 1.x projects. This package is for Channels 2 projects only.
Your solution is to not use asgi_redis and use channels_redis instead.

Python module ortools apparently installs incompletely

I am trying to set up ortools on my Mac.
I installed via pip install ortools. I can verify that the package installed successfully.
conda list | grep ortools
WARNING: The conda.compat module is deprecated and will be removed in a future release.
ortools 7.1.6720 pypi_0 pypi
When I try to use the library, it looks like there are missing functions. I followed along with the example here:
https://developers.google.com/optimization/introduction/python
This returns an error:
from __future__ import print_function
from ortools.linear_solver import pywraplp
Traceback (most recent call last):
File "simple_ortools_example.py", line 2, in <module>
from ortools.linear_solver import pywraplp
ImportError: No module named ortools.linear_solver
I can import the module otherwise and look at the functions interactively:
>>> ortools.__
ortools.__cached__ ortools.__gt__( ortools.__path__
ortools.__class__( ortools.__hash__( ortools.__reduce__(
ortools.__delattr__( ortools.__init__( ortools.__reduce_ex__(
ortools.__dict__ ortools.__init_subclass__( ortools.__repr__(
ortools.__dir__( ortools.__le__( ortools.__setattr__(
ortools.__doc__ ortools.__loader__ ortools.__sizeof__(
ortools.__eq__( ortools.__lt__( ortools.__spec__
ortools.__file__ ortools.__name__ ortools.__str__(
ortools.__format__( ortools.__ne__( ortools.__subclasshook__(
ortools.__ge__( ortools.__new__( ortools.__version__
ortools.__getattribute__( ortools.__package__
I just used tab complete here to see what was available. Sure enough there is no linear_solver attached to the ortools module.
I'm a bit at a loss as to what to try next. Any advice would be apreciated.
I downgraded to an earlier version which solves the problem.
pip install ortools==6.7.4973
I faced the same issue today on Windows. Figured out that it is usually caused due to missing Microsoft Visual Studio 20** redistributables c++ (see here).
This is how I solved it (Python 3.7.6, ortools Version: 7.5.*).
Got the latest Microsoft Visual Studio 20** redistributables c++ from https://support.microsoft.com/en-my/help/2977003/the-latest-supported-visual-c
downloads
Installed it and Restarted the computer.
Uninstall the ortools 'python -m pip uninstall ortools'
Install back the ortools 'python -m pip install --user ortools'
Validated installation with python -c "from ortools.linear_solver import pywraplp"

Python wkhtmltopdf can't import module

I am using Python version 3.6, Django version 1.9 and wkhtmltopdf version 0.2. My Python is not GCC it's Anaconda3.
When running my project which uses wkhtmltopdf, following error will be thrown:
from main import WKhtmlToPdf, wkhtmltopd
ModuleNotFoundError: No module named 'main'
This is how I imported the wkhtmltopdf:
import pdfkit
from wkhtmltopdf.views import PDFTemplateView
Yes i got the answer. This error occurred because i didn't installed django-wkhtmltopdf.
installed >> `pip install django-wkhtmltopdf
I hope this answer will help to resolve the similar error.
after installing pdfkit with following command and pointing python version 3.8, i was able to get pdfkit working on mac
pip3 install pdfkit

Categories

Resources