I made a registration system with Django using celery, redis. It was working fine till today. But getting this error 'Redis is not install' when try to register a new user. I was trying to check packages installed using pip and getting this.
Traceback (most recent call last):
File "/home/chhuti/projects/venv/chhuti/bin/pip", line 7, in <module>
from pip import main
File "/home/chhuti/projects/venv/chhuti/lib/python3.6/site-
packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/home/chhuti/projects/venv/chhuti/lib/python3.6/site-
packages/pip/utils/__init__.py", line 23, in <module>
from pip.locations import (
File "/home/chhuti/projects/venv/chhuti/lib/python3.6/site-
packages/pip/locations.py", line 9, in <module>
from distutils import sysconfig
File
"/home/chhuti/projects/venv/chhuti/lib/python3.6/distutils/__init__.py", line 25, in <module>
from distutils import dist, sysconfig
ImportError: cannot import name 'dist'
I am using
pip version 9.0.2,
Python version 3.6.3
Django 1.11
Have been stuck here for a long time now, couldn't solve it.
Related
Started having issues running Django. Install runs without error, however when I check the version packages that show "already satisified" are not found.
I've removed my .local and re-installed files, no change.
% pip3 install /path/.../Django-3.0b1/ --user
Processing /path/.../Django-3.0b1
Requirement already satisfied: pytz in /usr/lib/python3.6/site-packages (from Django==3.0b1) (2018.5)
Requirement already satisfied: sqlparse in /path/.../.local/lib/python3.6/site-packages (from Django==3.0b1) (0.3.0)
Requirement already satisfied: asgiref in path/.../.local/lib/python3.6/site-packages (from Django==3.0b1) (3.2.3)
Installing collected packages: Django
Running setup.py install for Django ... done
Successfully installed Django-3.0b1
% python3 -m django --version
Traceback (most recent call last):
File "/path/.../python/3.7.3b/lib/python3.7/runpy.py", line 193, in
_run_module_as_main "__main__", mod_spec)
File "/path/.../python/3.7.3b/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals)
File "/path/.../Django-3.0b1/django/__main__.py", line 6, in <module> from django.core import management
File "/path/.../Django-3.0b1/django/core/management/__init__.py", line 14, in <module> from django.core.management.base import (
File "/path/.../Django-3.0b1/django/core/management/base.py", line 11, in <module> from django.core import checks
File "/path/.../Django-3.0b1/django/core/checks/__init__.py", line 9, in <module> import django.core.checks.database # NOQA isort:skip
File "/path/.../Django-3.0b1/django/core/checks/database.py", line 1, in <module> from django.db import connections
File "/path/.../Django-3.0b1/django/db/__init__.py", line 2, in <module> from django.db.utils import (
File "/path/.../Django-3.0b1/django/db/utils.py", line 5, in <module> from asgiref.local import Local
ModuleNotFoundError: No module named 'asgiref'
After upgrading my Ubuntu desktop to 18.04 from 16.04, the django's virtualenv refuses to start:
(.djangoenv) mw#desktop:~/theapp$ python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
File "/home/mw/.djangoenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 10, in <module>
from django.apps import apps
File "/home/mw/.djangoenv/local/lib/python2.7/site-packages/django/apps/__init__.py", line 1, in <module>
from .config import AppConfig # NOQA
File "/home/mw/.djangoenv/local/lib/python2.7/site-packages/django/apps/config.py", line 4, in <module>
from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured
File "/home/mw/.djangoenv/local/lib/python2.7/site-packages/django/core/exceptions.py", line 5, in <module>
from django.utils.encoding import force_text
File "/home/mw/.djangoenv/local/lib/python2.7/site-packages/django/utils/encoding.py", line 10, in <module>
from django.utils.functional import Promise
File "/home/mw/.djangoenv/local/lib/python2.7/site-packages/django/utils/functional.py", line 1, in <module>
import copy
File "/usr/lib/python2.7/copy.py", line 52, in <module>
import weakref
File "/usr/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
On the djangoenv and outside it
$ python --version :
`Python 2.7.12`
Hoping to resolve the issue, I also install Python 2.7.16 on the desktop, so I get:
$ python2.7 --version
Python 2.7.16
Also when I try to install new virtualenv, I get the same error:
$ virtualenv .blaenv
Running virtualenv with interpreter /home/mw/.djangoenv/bin/python2
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/virtualenv.py", line 21, in <module>
import logging
File "/usr/lib/python2.7/logging/__init__.py", line 26, in <module>
import sys, os, time, cStringIO, traceback, warnings, weakref, collections
File "/usr/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
Answers to the same error in other contexts did not help and my search led to no more clues.
So really appreciate your hints.
As per https://askubuntu.com/questions/981663/python2-7-broken-by-weakref-import-error-please-help you probably need to recreate your virtualenv. I suspect your problem here is that you need to deactivate your current env before you try to make the new one, in order to ensure that your system python2 interpreter is the one running the virtualenv command.
My sklearn works well before, after installing and updating a couple of other packages, I cannot import any model from sklearn.
The versions:
Python 2.7.12
Anaconda 2.4.1 (x86_64)
sklearn: 0.17.1 (downgrade from 0.18)
spicy: 0.18.1
Measures I've tried:
restart the shell---> same error
uninstall sklearn, and reinstall it (the newest version is 0.18), downgrade it to 0.17--> same error
install sklearn and keep the version 0.18 -->still error
My code:
from sklearn import svm
The error
Traceback (most recent call last):
File "<ipython-input-1-fe795c4388c4>", line 3, in <module>
from sklearn import svm
File "//anaconda/lib/python2.7/site-packages/sklearn/svm/__init__.py", line 13, in <module>
from .classes import SVC, NuSVC, SVR, NuSVR, OneClassSVM, LinearSVC, \
File "//anaconda/lib/python2.7/site-packages/sklearn/svm/classes.py", line 4, in <module>
from .base import _fit_liblinear, BaseSVC, BaseLibSVM
File "//anaconda/lib/python2.7/site-packages/sklearn/svm/base.py", line 11, in <module>
from ..preprocessing import LabelEncoder
File "//anaconda/lib/python2.7/site-packages/sklearn/preprocessing/__init__.py", line 8, in <module>
from .data import Binarizer
File "//anaconda/lib/python2.7/site-packages/sklearn/preprocessing/data.py", line 25, in <module>
from ..utils.sparsefuncs import (inplace_column_scale,
ImportError: cannot import name inplace_column_scale
Besides svm, when I import tree, linear_model, the same thing happens.
from sklearn.models import linear_model
The error:
Traceback (most recent call last):
File "<ipython-input-3-540f6792b379>", line 1, in <module>
from sklearn.models import linear_model
ImportError: No module named models
Code:
from sklearn import tree
error:
Traceback (most recent call last):
File "<ipython-input-4-fcc6e7d2ee3e>", line 1, in <module>
from sklearn import tree
File "//anaconda/lib/python2.7/site-packages/sklearn/tree/__init__.py", line 6, in <module>
from .tree import DecisionTreeClassifier
File "//anaconda/lib/python2.7/site-packages/sklearn/tree/tree.py", line 30, in <module>
from ..feature_selection.from_model import _LearntSelectorMixin
File "//anaconda/lib/python2.7/site-packages/sklearn/feature_selection/__init__.py", line 7, in <module>
from .univariate_selection import chi2
File "//anaconda/lib/python2.7/site-packages/sklearn/feature_selection/univariate_selection.py", line 15, in <module>
from ..preprocessing import LabelBinarizer
File "//anaconda/lib/python2.7/site-packages/sklearn/preprocessing/__init__.py", line 8, in <module>
from .data import Binarizer
File "//anaconda/lib/python2.7/site-packages/sklearn/preprocessing/data.py", line 25, in <module>
from ..utils.sparsefuncs import (inplace_column_scale,
ImportError: cannot import name inplace_column_scale
To solve the error:
ImportError: cannot import name 'OrdinalEnconder' from 'sklearn.preprocessing'
(C:\ProgramData\Anaconda3\lib\site-packages\sklearn\preprocessing\__init__.py)
You need to go path "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\preprocessing" and check the name of OneLabelEncoder in python file __init__.py . The name may be LabelEncoder or a different name. You need import the module with same name.
The following screenshot should help you understand this better:
Try this within your terminal:
conda install -c anaconda scikit-learn=0.18.1
If it does not work go to your terminal and try:
conda update anaconda
After the update is complete, then try the first bit of code again
Hopefully it works
please see this question.
ImportError: cannot import name inplace_column_scale.
I think you face the same problem. There are several ways to solve it.
For windows. delete python27\Lib\site-packages\sklearn\utils\sparsefuncs.pyd.
For mac and linux, delete /usr/local/lib/python2.7/site-packages/sklearn/utils/sparsefuncs.so.
If you use anaconda, delete anaconda/lib/python2.7/site-packages/sklearn/utils/sparsefuncs.so
reinstall the sklearn.
pip uninstall scikit-learn
pip install scikit-learn
Just did an upgrade from ubuntu 12.10 to 13.04 and getting this when running django site in virtualenv
(virtualenv)sysadmin#ubuntu:~/webapps/devsite/djangosite$ ./manage.py runserver
Traceback (most recent call last):
File "./manage.py", line 2, in <module>
from django.core.management import execute_manager
File "/home/sysadmin/webapps/devsite/virtualenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 7, in <module>
from django.core.management.base import BaseCommand, CommandError, handle_default_options
File "/home/sysadmin/webapps/devsite/virtualenv/local/lib/python2.7/site-packages/django/core/management/base.py", line 14, in <module>
from django.utils.encoding import smart_str
File "/home/sysadmin/webapps/devsite/virtualenv/local/lib/python2.7/site-packages/django/utils/encoding.py", line 4, in <module>
import datetime
ImportError: No module named datetime
Just do
virtualenv /home/sysadmin/webapps/devsite/virtualenv/
this will reinstall Python in the VirtualEnv and it will work after that (and you won't need to reinstall the libraries).
Update: when I was dealing with the same problem after upgrading from 14.04 to 14.10, virtualenv didn't want to overwrite the existing symlink to Python, so I had to remove it first (in this example that would be rm /home/sysadmin/webapps/devsite/virtualenv/python)
I installed subversion, which seemed to install Python25, which my computer won't let me erase, or even recognize as a program on the control panel. I copied my Python27 Python.py file into the Python 25 folder to replace Python.py (the Python 25 version), and got my command prompt to run Python 27 (even though I had specified the Python 27 folder, it insisted on running Python 25). I copied the Django trunk into the site-packages of Django 27 and Django 25. Import Django works in Python, but now I'm getting this error:
C:\Windows\system32>cd C:\Users\Susan\Documents\practice
C:\Users\Susan\Documents\practice>django-admin.py startproject mysite
Traceback (most recent call last):
File "C:\csvn\Python25\django-admin.py", line 2, in <module>
from django.core import management
File "C:\csvn\Python25\lib\site-packages\django\core\management\__init__.py",
line 7, in <module>
from django.core.management.base import BaseCommand, CommandError, handle_de
fault_options
File "C:\csvn\Python25\lib\site-packages\django\core\management\base.py", line
14, in <module>
from django.utils.encoding import smart_str
File "C:\csvn\Python25\lib\site-packages\django\utils\encoding.py", line 2, in
<module>
import urllib
File "C:\csvn\Python25\lib\urllib.py", line 26, in <module>
import socket
File "C:\csvn\Python25\lib\socket.py", line 45, in <module>
import _socket
ImportError: Module use of python25.dll conflicts with this version of Python.
Thanks in advance.
Oh, and this is my environment path variable: C:\Program Files\SSH Communications Security\SSH Secure Shell;C:\Python27;C\Python27\scripts;C:\Python27\Lib\site-packages\django\bin\
And this is my python variable: C:\Python27;C\Python27\scripts;C:\Python27\Lib\site-packages\django\bin\
EDIT: realized that USER path wasn't the same as System path. Made them both the same, now receiving this message:
C:\Users\Susan\Documents\practice>django-admin.py startproject mysite
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\django\django\bin\django-admin.py", line 2
, in <module>
from django.core import management
File "C:\csvn\Python25\lib\site-packages\django\core\management\__init__.py",
line 7, in <module>
from django.core.management.base import BaseCommand, CommandError, handle_de
fault_options
File "C:\csvn\Python25\lib\site-packages\django\core\management\base.py", line
14, in <module>
from django.utils.encoding import smart_str
File "C:\csvn\Python25\lib\site-packages\django\utils\encoding.py", line 2, in
<module>
import urllib
File "C:\csvn\Python25\lib\urllib.py", line 26, in <module>
import socket
File "C:\csvn\Python25\lib\socket.py", line 45, in <module>
import _socket
ImportError: DLL load failed: The specified module could not be found.
Why does it keep trying to use Python25?
I would un-install Python 2.7 and 2.5 from your machine and re-inistall Python 2.7. You'll have to have a working Python install before you can think about installing Django.
After that's working, I would recommend installing virtualenv and Justin Driscoll's virtualenv helper for Windows.
Virtualenv allows you to create different Python runtimes so you don't have to install modules directly into the system Python Path. Installing virtualenv gets you pip, which you can use to install modules like Django, into your virtualenv's site-packages folder.