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.
Related
I am having some trouble with dependencies within my python conda environement. I need to have both libraries Tornado x msgpack-rpc-python. However both seems to be not compatible.
Here are the errors I am receiving:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
nbclassic 0.4.8 requires tornado>=6.1, but you have tornado 4.5.3 which is incompatible.
jupyter-server 1.21.0 requires tornado>=6.1.0, but you have tornado 4.5.3 which is incompatible.
jupyter-client 7.4.7 requires tornado>=6.2, but you have tornado 4.5.3 which is incompatible.
ipyparallel 8.4.1 requires tornado>=5.1, but you have tornado 4.5.3 which is incompatible.
ipykernel 6.15.2 requires tornado>=6.1, but you have tornado 4.5.3 which is incompatible.
HOWEVER when I try to upgrate tornado I get this error:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of **the following dependency conflicts.
msgpack-rpc-python 0.4.1 requires tornado<5,>=3, but you have tornado 6.2 which is incompatible.**
I also tried to downgrade the list above(jupyter client, ..) however the environnement turn out to be unsustainable and non functional. I tried several times to create a new environment but no luck , I suppose I am doing things wrong but not sure what to do??
I have been trying to find a solution to this circular problem but I have been stuck on it for a long long time and getting out of ideas. I have downloaded Synk to help out but it is telling me the same thing is still a circular solution : updagrate tornado.
Background information:
Linux
Ubuntu 20.04
Coding in Visual Studio
Environment py38 (3.8.15)
Any help is appreciated!!
Thanks so much,
I am trying to run pre-commit hooks, but they fail when they come across the isort hook which throws the error below:
File "/home/el/.cache/pre-commit/repoffrjhcx0/py_env-python3/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 92, in create_module
return importlib.import_module('setuptools._distutils')
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'setuptools'
I am using docker, and I have checked that setuptools is installed on both my machine globally, and on my docker. I do not understand why this error occurs. I think isort sets up it's own environment, but then why would it be not installed since it is defined in their config file pyproject.toml.
Below are my pre-commit and isort configs:
.pre-commit-config.yaml
repos:
- repo: https://github.com/pycqa/isort
rev: 5.8.0
hooks:
- id: isort
args: ["--multi-line=5", "--line-length=120", "--use-parentheses", "--filter-files"]
exclude: "migrations"
stages: [commit]
tox.ini
[isort]
line_length=120
skip_glob=*migrations*
multi_line_output=5
sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
use_parentheses=true
include_trailing_comma=true
lines_between_types=1
lines_after_imports=2
[testenv:isort]
deps =
isort
commands =
isort . --check-only --diff
Python version on system: 3.10.1
Python version on docker: 3.8
I appreciate any help!
this was a bug in setuptools which has already been fixed (see also the pinned issue on isort)
you can work around this bug by setting the following environment variable: SETUPTOOLS_USE_DISTUTILS=stdlib
the version of setuptools comes from the version of virtualenv you're using, so you may want to upgrade to get the correct version
here's a longer summary of what went wrong with setuptools:
here's the relevant things to follow up on:
https://github.com/pypa/setuptools/issues/2353
https://github.com/pypa/pip/issues/6264
https://github.com/pypa/setuptools/issues/2980
why we're suddenly seeing this:
the latest virtualenv release upgraded setuptools to 60.1.0 (despite what the changelog
says
it was upgraded to 60.1.0
here)
setuptools 60.* changes the default to using the setuptools-embedded distutils rather than the stdlib distutils
setuptools does this by way of a .pth file which redirects imports of distutils to setuptools._distutils
during pip's isolated builds (triggered by pyproject.toml, for example to install isort via poetry) pip attempts to clear the
current sys.path of the enclosing environment and isolates to the
pyproject.toml-installed build dependencies, but it's a bit too late
as the .pth files from the enclosing environment are applied. so in
this environment setuptools is not installed, but its import hooks
are
disclaimer: I created pre-commit
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
Firstly, I installed torch 1.1.0, and then I installed its' dependencies. So, I can import torch_scatter 1.2.0 however I get this error when importing torch_scatter.scatter_cuda:
import torch_scatter.scatter_cuda
ModuleNotFoundError: No module named 'torch_scatter.scatter_cuda'
I have Cuda v10 installed and I have a GPU. All of the requirements for this code were installed together through pip in one go on my virtual environment.
As pointed out by phd - it looks like the setup.py file of pytorch_scatter checks for and uses an available cuda installation automatically.
Also in the version you are using as seen here:
...
if CUDA_HOME is not None:
ext_modules += [
CUDAExtension('torch_scatter.scatter_cuda',
['cuda/scatter.cpp', 'cuda/scatter_kernel.cu'])
]
...
Might be a question of whether CUDA_HOME is available.
Installing from source might give you more information as suggested here.
I'm get an error when running "python manage.py makemigrations" command in putty.
from dslam.views import *
File "/opt/PortMan/portman_web/dslam/views.py", line 16, in <module>
from django.contrib.postgres.search import SearchVector
ImportError: No module named search
When running pip install django-contrib-postgres command, I'm get this message:
Requirement already satisfied: equirement already satisfied: /usr/local/lib/python2.7/dist-packages (0.0.1)
pip install django-contrib-postgres installs this, which seems to be a stand-alone extract of django.contrib.postgres, which is usually part of a complete django installation. According to the README it does not provide django.contrib.postgres and also shouldn't as it is not a complete django installation. I recommend to just install django:
pip uninstall django-contrib-postgres
pip install django
Then you should be able to do from django.contrib.postgres.search import SearchVector just fine
django.contrib.postgres.search was added in Django 1.10, so you can't use it with django-contrib-postgres, which is a backport from Django 1.9.
Note that Django 1.8 has been end of life for years and is insecure. You should upgrade to the latest Django 1.11.X LTS, or even better, upgrade to Python 3 and the latest Django 2.2.X LTS.