This is the hints,how can I resolve it?
I use Python 3.5.1 created a virtual envirement by virtualenv
The source code works well on my friend's computer machine
Error:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "A:\Python3.5\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_line
utility.execute()
File "A:\Python3.5\lib\site-packages\django\core\management\__init__.py", line 354, in execute
django.setup()
File "A:\Python3.5\lib\site-packages\django\__init__.py", line 18, in setup
from django.utils.log import configure_logging
File "A:\Python3.5\lib\site-packages\django\utils\log.py", line 13, in <module>
from django.views.debug import ExceptionReporter, get_exception_reporter_filter
File "A:\Python3.5\lib\site-packages\django\views\debug.py", line 10, in <module>
from django.http import (HttpResponse, HttpResponseServerError,
File "A:\Python3.5\lib\site-packages\django\http\__init__.py", line 4, in <module>
from django.http.response import (
File "A:\Python3.5\lib\site-packages\django\http\response.py", line 13, in <module>
from django.core.serializers.json import DjangoJSONEncoder
File "A:\Python3.5\lib\site-packages\django\core\serializers\__init__.py", line 23, in <module>
from django.core.serializers.base import SerializerDoesNotExist
File "A:\Python3.5\lib\site-packages\django\core\serializers\base.py", line 6, in <module>
from django.db import models
File "A:\Python3.5\lib\site-packages\django\db\models\__init__.py", line 6, in <module>
from django.db.models.query import Q, QuerySet, Prefetch # NOQA
File "A:\Python3.5\lib\site-packages\django\db\models\query.py", line 13, in <module>
from django.db.models.fields import AutoField, Empty
File "A:\Python3.5\lib\site-packages\django\db\models\fields\__init__.py", line 18, in <module>
from django import forms
File "A:\Python3.5\lib\site-packages\django\forms\__init__.py", line 6, in <module>
from django.forms.fields import * # NOQA
File "A:\Python3.5\lib\site-packages\django\forms\fields.py", line 18, in <module>
from django.forms.utils import from_current_timezone, to_current_timezone
File "A:\Python3.5\lib\site-packages\django\forms\utils.py", line 15, in <module>
from django.utils.html import format_html, format_html_join, escape
File "A:\Python3.5\lib\site-packages\django\utils\html.py", line 16, in <module>
from .html_parser import HTMLParser, HTMLParseError
File "A:\Python3.5\lib\site-packages\django\utils\html_parser.py", line 12, in <module>
HTMLParseError = _html_parser.HTMLParseError
AttributeError: module 'html.parser' has no attribute 'HTMLParseError'
As you can read here this error is raised...
because HTMLParseError is deprecated from Python 3.3 onwards and removed in Python 3.5.
What you can do is downgrade your Python version or upgrade your Django version.
I've just got the same error here. The Django version installed on my machine was 1.7.
Upgrading to Django 1.8.* solved the problem for me.
You can upgrade your Django using following command:
If you are using pip3:
sudo pip3 install django --upgrade
If pip:
sudo pip install django --upgrade
pip install Django --upgrade
python manage.py runserver
Related
I have an issue to install the gcloud sdk on my mac. I have the following error when I do the ./install.sh. Source: https://cloud.google.com/sdk/docs/quickstart
Welcome to the Google Cloud SDK!
Traceback (most recent call last):
File "/Users/kevin/Downloads/google-cloud-sdk/bin/bootstrapping/install.py", line 12, in <module>
import bootstrapping
File "/Users/kevin/Downloads/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 32, in <module>
import setup # pylint:disable=g-import-not-at-top
File "/Users/kevin/Downloads/google-cloud-sdk/bin/bootstrapping/setup.py", line 57, in <module>
from googlecloudsdk.core.util import platforms
File "/Users/kevin/Downloads/google-cloud-sdk/lib/googlecloudsdk/__init__.py", line 23, in <module>
from googlecloudsdk.core.util import importing
File "/Users/kevin/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/util/importing.py", line 23, in <module>
import imp
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/imp.py", line 23, in <module>
from importlib import util
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/importlib/util.py", line 2, in <module>
from . import abc
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/importlib/abc.py", line 17, in <module>
from typing import Protocol, runtime_checkable
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/typing.py", line 26, in <module>
import re as stdlib_re # Avoid confusion with the re we export.
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/re.py", line 124, in <module>
import enum
File "/Users/kevin/Downloads/google-cloud-sdk/lib/third_party/enum/__init__.py", line 26, in <module>
spec = importlib.util.find_spec('enum')
AttributeError: module 'importlib' has no attribute 'util'
And when I do gcloud init
Traceback (most recent call last):
File "/Users/kevin/Downloads/google-cloud-sdk/lib/gcloud.py", line 104, in <module>
main()
File "/Users/kevin/Downloads/google-cloud-sdk/lib/gcloud.py", line 62, in main
from googlecloudsdk.core.util import encoding
File "/Users/kevin/Downloads/google-cloud-sdk/lib/googlecloudsdk/__init__.py", line 23, in <module>
from googlecloudsdk.core.util import importing
File "/Users/kevin/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/util/importing.py", line 23, in <module>
import imp
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/imp.py", line 23, in <module>
from importlib import util
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/importlib/util.py", line 2, in <module>
from . import abc
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/importlib/abc.py", line 17, in <module>
from typing import Protocol, runtime_checkable
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/typing.py", line 26, in <module>
import re as stdlib_re # Avoid confusion with the re we export.
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/re.py", line 124, in <module>
import enum
File "/Users/kevin/Downloads/google-cloud-sdk/lib/third_party/enum/__init__.py", line 26, in <module>
spec = importlib.util.find_spec('enum')
AttributeError: module 'importlib' has no attribute 'util'
I think this is a Python issue. but I'm running Python3:
python -V shows
Python 3.9.0
I have installed it with homebrew.
What can be the problem?
This is a known issue across Mac, Windows and Linux: https://issuetracker.google.com/170125513.
I'd suggest to use the recommended Python versions mentioned here (3.5 to 3.8).
Also this does not affect only to Cloud SDK but others as well (for example as mentioned here).
Thanks for your answer. Indeed, it works with the version 3.8.6 of python.
I will add some infos if it can help somebody. In order to manage python version, I have used pyenv and installed the version of python I needed.
pyenv install 3.8.6
pyenv global 3.8.6
If you want a quick fix you can add this to your bash profile and restart your terminal:
export CLOUDSDK_PYTHON=python3.8
Worked for me
I am trying to setup apache airflow on aws ec2(ubuntu 18.04)
Python version: 3.6.9
Pip Version: 9.0.1
To Install Apache Airflow I have used below command.
pip3 install apache-airflow[postgres,celery,rabbitmq,ldap,crypto,aws]
while I execute airflow initdb it shows me error
File "/home/ubuntu/.local/bin/airflow", line 26, in <module>
from airflow.bin.cli import CLIFactory
File "/home/ubuntu/.local/lib/python3.6/site-packages/airflow/bin/cli.py", line 71, in <module>
from airflow.www_rbac.app import cached_app as cached_app_rbac
File "/home/ubuntu/.local/lib/python3.6/site-packages/airflow/www_rbac/app.py", line 28, in <module>
from flask_appbuilder import AppBuilder, SQLA
File "/home/ubuntu/.local/lib/python3.6/site-packages/flask_appbuilder/__init__.py", line 6, in <module>
from .base import AppBuilder # noqa: F401
File "/home/ubuntu/.local/lib/python3.6/site-packages/flask_appbuilder/base.py", line 8, in <module>
from .api.manager import OpenApiManager
File "/home/ubuntu/.local/lib/python3.6/site-packages/flask_appbuilder/api/manager.py", line 7, in <module>
from flask_appbuilder.baseviews import BaseView
File "/home/ubuntu/.local/lib/python3.6/site-packages/flask_appbuilder/baseviews.py", line 21, in <module>
from .forms import GeneralModelConverter
File "/home/ubuntu/.local/lib/python3.6/site-packages/flask_appbuilder/forms.py", line 17, in <module>
from .fieldwidgets import (
File "/home/ubuntu/.local/lib/python3.6/site-packages/flask_appbuilder/fieldwidgets.py", line 3, in <module>
from wtforms.widgets import html_params, HTMLString
ImportError: cannot import name 'HTMLString'
can somebody help me with this?
Thanks, Mariusz for the help.
I followed the steps mentioned
https://github.com/apache/airflow/issues/8506#issuecomment-617515743
and add --constraint https://raw.githubusercontent.com/apache/airflow/1.10.10/requirements/requirements-python3.7.txt after my pip install command and it got working.
It was an error with WTForms new release version
I am getting the following error while using pip command, in anaconda.
C:\Users\name>pip install xmlschema
Traceback (most recent call last):
File "C:\ANACONDA2\Scripts\pip-script.py", line 9, in <module>
load_entry_point('pip==9.0.1', 'console_scripts', 'pip')()
File "C:\ANACONDA2\lib\site-packages\setuptools-18.4-py2.7.egg\pkg_resources\__init__.py", line 558, in load_entry_point
File "C:\ANACONDA2\lib\site-packages\setuptools-18.4-py2.7.egg\pkg_resources\__init__.py", line 2682, in load_entry_point
File "C:\ANACONDA2\lib\site-packages\setuptools-18.4-py2.7.egg\pkg_resources\__init__.py", line 2355, in load
File "C:\ANACONDA2\lib\site-packages\setuptools-18.4-py2.7.egg\pkg_resources\__init__.py", line 2361, in resolve
File "c:\anaconda2\lib\site-packages\pip\__init__.py", line 28, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "c:\anaconda2\lib\site-packages\pip\vcs\subversion.py", line 9, in <module>
from pip.index import Link
File "c:\anaconda2\lib\site-packages\pip\index.py", line 33, in <module>
from pip._vendor import html5lib, requests, six
File "c:\anaconda2\lib\site-packages\pip\_vendor\html5lib\__init__.py", line 19, in <module>
from .serializer import serialize
File "c:\anaconda2\lib\site-packages\pip\_vendor\html5lib\serializer\__init__.py", line 5, in <module>
from .htmlserializer import HTMLSerializer
File "c:\anaconda2\lib\site-packages\pip\_vendor\html5lib\serializer\htmlserializer.py", line 11, in <module>
from .. import utils
ImportError: cannot import name utils
I am having utils package, but still throwing ImportError: cannot import name utils
On windows there is no sudo command. You have to run the command line as administrator and run the pip commands from above without sudo.
you can try this commands to fix it:
pip uninstall requests
pip install --upgrade requests
if you have trouble about to execute pip command on windows, check this link
I have a ubuntu server.(10.04)
I don't install requests module. I try pip and other methods. Usually ;
$ sudo pip install requests
Traceback (most recent call last):
File "/usr/local/lib/python3.1/dist-packages/pip-1.5.5-py3.1.egg/pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py", line 3, in <module>
from ssl import CertificateError, match_hostname
ImportError: cannot import name CertificateError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.1/dist-packages/pip-1.5.5-py3.1.egg/pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py", line 7, in <module>
from backports.ssl_match_hostname import CertificateError, match_hostname
ImportError: No module named backports.ssl_match_hostname
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.5', 'console_scripts', 'pip')()
File "/usr/local/lib/python3.1/dist-packages/distribute-0.6.49-py3.1.egg/pkg_resources.py", line 345, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python3.1/dist-packages/distribute-0.6.49-py3.1.egg/pkg_resources.py", line 2382, in load_entry_point
return ep.load()
File "/usr/local/lib/python3.1/dist-packages/distribute-0.6.49-py3.1.egg/pkg_resources.py", line 2088, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/local/lib/python3.1/dist-packages/pip-1.5.5-py3.1.egg/pip/__init__.py", line 11, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/local/lib/python3.1/dist-packages/pip-1.5.5-py3.1.egg/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/local/lib/python3.1/dist-packages/pip-1.5.5-py3.1.egg/pip/download.py", line 22, in <module>
from pip._vendor import requests, six
File "/usr/local/lib/python3.1/dist-packages/pip-1.5.5-py3.1.egg/pip/_vendor/requests/__init__.py", line 58, in <module>
from . import utils
File "/usr/local/lib/python3.1/dist-packages/pip-1.5.5-py3.1.egg/pip/_vendor/requests/utils.py", line 25, in <module>
from .compat import parse_http_list as _parse_list_header
File "/usr/local/lib/python3.1/dist-packages/pip-1.5.5-py3.1.egg/pip/_vendor/requests/compat.py", line 7, in <module>
from .packages import chardet
File "/usr/local/lib/python3.1/dist-packages/pip-1.5.5-py3.1.egg/pip/_vendor/requests/packages/__init__.py", line 3, in <module>
from . import urllib3
File "/usr/local/lib/python3.1/dist-packages/pip-1.5.5-py3.1.egg/pip/_vendor/requests/packages/urllib3/__init__.py", line 16, in <module>
from .connectionpool import (
File "/usr/local/lib/python3.1/dist-packages/pip-1.5.5-py3.1.egg/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 31, in <module>
from .packages.ssl_match_hostname import CertificateError
File "/usr/local/lib/python3.1/dist-packages/pip-1.5.5-py3.1.egg/pip/_vendor/requests/packages/urllib3/packages/__init__.py", line 3, in <module>
from . import ssl_match_hostname
File "/usr/local/lib/python3.1/dist-packages/pip-1.5.5-py3.1.egg/pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py", line 10, in <module>
from _implementation import CertificateError, match_hostname
ImportError: No module named _implementation
I guess I have already setup pip 3.1. But following
$ pip -V
Then I see same problem. How to install requests module for Python 3.1 ubuntu server 10.04?
Have you tried easy_install requests?
Or you could try a non-fancy way. Google requests package, download it, unzip it and then run setup.py script like this:
python setup.py install
Have you tried pip install backports.ssl-match-hostname
Probably no harm to upgrade Python either.
When importing djcelery i am getting the below error. Is there any other method to install?
Traceback (most recent call last):
File "manage.py", line 15, in <module>
import settings
File "/home/c0mrade/Documents/wipi/wishpicker/settings.py", line 7, in <module>
import djcelery
File "/usr/local/lib/python2.7/dist-packages/djcelery/__init__.py", line 22, in <module>
from celery import current_app as celery # noqa
File "/usr/local/lib/python2.7/dist-packages/celery/five.py", line 307, in __getattr__
module = __import__(self._object_origins[name], None, None, [name])
File "/usr/local/lib/python2.7/dist-packages/celery/_state.py", line 20, in <module>
from celery.utils.threads import LocalStack
File "/usr/local/lib/python2.7/dist-packages/celery/utils/__init__.py", line 351, in <module>
from .functional import chunks, noop # noqa
File "/usr/local/lib/python2.7/dist-packages/celery/utils/functional.py", line 18, in <module>
from kombu.utils.functional import lazy, maybe_evaluate, is_list, maybe_list
ImportError: cannot import name lazy
sudo pip install -U django-celery
if you use ubuntu variants. This upgrades all your packages django-celery is dependent on