15:12 ~ $ pip2.7 install --user chromedriver_installer
Collecting chromedriver_installer
Downloading chromedriver_installer-0.0.6.tar.gz
Building wheels for collected packages: chromedriver-installer
Running setup.py bdist_wheel for chromedriver-installer ... error
Complete output from command /usr/local/bin/python2.7 -u -c "import setuptools, tokenize;file='/tmp/pip-build-s8XaGy/chromedriver-installer/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" bdist_wheel -d /tmp/tmpg9ElMzpip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/chromedriver_installer
copying chromedriver_installer/init.py -> build/lib.linux-x86_64-2.7/chromedriver_installer
running build_scripts
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-s8XaGy/chromedriver-installer/setup.py", line 220, in
cmdclass=dict(build_scripts=BuildScripts, install=Install)
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/local/lib/python2.7/dist-packages/wheel/bdist_wheel.py", line 179, in run
self.run_command('build')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
self.run_command(cmd_name)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/tmp/pip-build-s8XaGy/chromedriver-installer/setup.py", line 119, in run
chromedriver_version = get_chromedriver_version()
File "/tmp/pip-build-s8XaGy/chromedriver-installer/setup.py", line 47, in get_chromedriver_version
.format(CHROMEDRIVER_INFO_URL))
Exception: Unable to get latest chromedriver version from https://sites.google.com/a/chromium.org/chromedriver/downloads
Failed building wheel for chromedriver-installer
Running setup.py clean for chromedriver-installer
Failed to build chromedriver-installer
Installing collected packages: chromedriver-installer
Running setup.py install for chromedriver-installer ... error
Complete output from command /usr/local/bin/python2.7 -u -c "import setuptools, tokenize;file='/tmp/pip-build-s8XaGy/chromedriver-installer/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-CnRwTc-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/chromedriver_installer
copying chromedriver_installer/init.py -> build/lib.linux-x86_64-2.7/chromedriver_installer
running build_scripts
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-s8XaGy/chromedriver-installer/setup.py", line 220, in
cmdclass=dict(build_scripts=BuildScripts, install=Install)
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
cmd_obj.run()
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/tmp/pip-build-s8XaGy/chromedriver-installer/setup.py", line 190, in run
install.run(self)
File "/usr/lib/python2.7/distutils/command/install.py", line 601, in run
self.run_command('build')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
self.run_command(cmd_name)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/tmp/pip-build-s8XaGy/chromedriver-installer/setup.py", line 119, in run
chromedriver_version = get_chromedriver_version()
File "/tmp/pip-build-s8XaGy/chromedriver-installer/setup.py", line 47, in get_chromedriver_version
.format(CHROMEDRIVER_INFO_URL))
Exception: Unable to get latest chromedriver version from https://sites.google.com/a/chromium.org/chromedriver/downloads
----------------------------------------
Command "/usr/local/bin/python2.7 -u -c "import setuptools, tokenize;file='/tmp/pip-build-s8XaGy/chromedriver-installer/setup.py';exec(compile(g
etattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-CnRwTc-record/install-record.tx
t --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-s8XaGy/chromedriver-installer/
Chrome doesn't really work on PythonAnywhere, so there's not much point to having chromedriver installed.
More info here: http://help.pythonanywhere.com/pages/selenium/
Related
My eb is on Amazon linux server:
without this command in config file my file deployed successfully
commands:
brewCommands:
command: brew install antiword
but when i added this, it is throwing error
cfnbootstrap.construction_errors.ToolError:
here is my cfn-init.log file error
Unhandled exception during build: Command 001_install failed Traceback (most recent call last):
File "/opt/aws/bin/cfn-init", line 176, in <module>
worklog.build(metadata, configSets) File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 137, in build
Contractor(metadata).build(configSets, self) File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 564, in build
self.run_config(config, worklog) File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 576, in run_config
CloudFormationCarpenter(config, self._auth_config).build(worklog) File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 276, in build
self._config.commands) File "/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py", line 127, in apply
raise ToolError(u"Command %s failed" % name)
cfnbootstrap.construction_errors.ToolError: Command 001_install failed
I am using MacOS 10.13.1 and python version 3.7.2.
I used pip3 install mysqlclient to install mysqlclient and it was successful:
MacBook-Air:~ user$ pip3 install mysqlclient
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/f8/9b/5db9a03e2088a87c26e3e4d4c7f7e8f4c2dbae610f9521cdfac15755a795/mysqlclient-1.4.5.tar.gz
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... done
Created wheel for mysqlclient: filename=mysqlclient-1.4.5-cp37-cp37m-macosx_10_9_x86_64.whl size=56101 sha256=3c1ab2eed45ecf064e60ceda15f2d85f4b01367e7c7e6ed887f483732b9d5e8c
Stored in directory: /Users/user/Library/Caches/pip/wheels/26/51/0c/3b9ab7013c539c744cddb55989ef494779fa08e8b273ab5ddf
Successfully built mysqlclient
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.4.5
pip3 list confirms that version 1.4.5 of mysqlclient has been installed.
However, when running python3 manage.py makemigrations in the directory containing my project, this error comes up:
MacBook-Air:averages user$ python3 manage.py shell
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 15, in <module>
import MySQLdb as Database
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/MySQLdb/__init__.py", line 18, in <module>
from . import _mysql
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so, 2): Library not loaded: #rpath/libmysqlclient.21.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so
Reason: image not found
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute
django.setup()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/models/base.py", line 117, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/models/base.py", line 321, in add_to_class
value.contribute_to_class(cls, name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/models/options.py", line 204, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/__init__.py", line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/utils.py", line 201, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/utils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 20, in <module>
) from err
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'averages_db',
'USER': 'user',
'PASSWORD': 'password',
}
}
I have looked at other posts with similar problems but I have found nothing of use. Any help would be appreciated.
Check if you are using Python3.7 when executing pip3:
pip3 --version
My output (debian) is:
pip 19.2.3 from /home/username/.local/lib/python3.5/site-packages/pip (python 3.5)
My version of pip3 is using Python3.5.
The solution to install it with python3.7 would be to execute:
python3.7 -m pip install mysqlclient
If that is the case, you might want to use the Python tool virtual environment link.
I had this error myself and for me the problem was that the pip install was placing my files into my /usr/local/mysql/lib folder. When trying to use it with python it is searching for the libraries in /usr/local/lib instead. Just copy pasting the files from my /usr/local/mysql/lib into /usr/local/lib solved the issue for me.
Note Library not loaded: #rpath/libmysqlclient.21.dylib near the start of the error message. I copy pasted that library and then the same error came up but with a different library. Copy pasted again twice more with libssl.1.1.dylib and then libcrypto.1.1.dylib. After putting all three of the mentioned libraries into /usr/local/lib, it worked fine.
You need run this command:
pip install mysqlclient
In your virtual environment. Link
I try to install a package HTML
python -m pip install HTML
Collecting HTML
Using cached html-1.16.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\836D~1\AppData\Local\Temp\pip-build-xorbgx2e\HTML\setup.py", line 12, in <module>
long_description = __doc__.decode('utf8'),
AttributeError: 'str' object has no attribute 'decode'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\836D~1\AppData\Local\Temp\pip-build-xorbgx2e\HTML\
There are many questions with this topic AttributeError: 'str' object has no attribute 'decode' but all of them for codes
How to fix the probem with installation?
I have the same issue when adding html to my poetry dependency file and then running poetry install:
Installing html (1.16): Failed
EnvCommandError
Command ['/project/.venv/bin/pip', 'install', '--no-deps', 'file:///home/user/.cache/pypoetry/artifacts/61/22/77/84e447e3655751d6c09f6688ea66d472bc206ff8f78f1e2ab51a5d6f0d/html-1.16.tar.gz'] errored with the following return code 1, and output:
Processing /home/user/.cache/pypoetry/artifacts/61/22/77/84e447e3655751d6c09f6688ea66d472bc206ff8f78f1e2ab51a5d6f0d/html-1.16.tar.gz
ERROR: Command errored out with exit status 1:
command: /home/user/project/.venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-i3m5e2vo/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-i3m5e2vo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-4j0cpo0e
cwd: /tmp/pip-req-build-i3m5e2vo/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-req-build-i3m5e2vo/setup.py", line 12, in <module>
long_description = __doc__.decode('utf8'),
AttributeError: 'str' object has no attribute 'decode'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Similarly, tried to install html with pip and got the ModuleNotFoundError error:
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-p5pkr50r/html/setup.py'"'"'; __file__='"'"'/tmp/pip-install-p5pkr50r/html/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-p5pkr50r/html/pip-egg-info
cwd: /tmp/pip-install-p5pkr50r/html/
Complete output (15 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.8/site-packages/setuptools/__init__.py", line 20, in <module>
from setuptools.depends import Require
File "/usr/lib/python3.8/site-packages/setuptools/depends.py", line 6, in <module>
from .py33compat import Bytecode
File "/usr/lib/python3.8/site-packages/setuptools/py33compat.py", line 11, in <module>
from six.moves import html_parser
File "/usr/lib/python3.8/site-packages/six.py", line 92, in __get__
result = self._resolve()
File "/usr/lib/python3.8/site-packages/six.py", line 115, in _resolve
return _import_module(self.mod)
File "/usr/lib/python3.8/site-packages/six.py", line 82, in _import_module
__import__(name)
ModuleNotFoundError: No module named 'html.parser'; 'html' is not a package
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I realized then, I don't need to install html explicitly in Python 3. It is included.
This code works by default for me:
import html
print(html.unescape("Hello<")) # prints 'Hello<'
II'm new on django .
I am using ubuntu 13.04
Although i created the databse through phpmyadmin and also entered the credentials in settings.py
but when i typed in the console
python manage.py syncdb
i got this error
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 453, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 272, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 77, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 8, in
from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
File "/usr/local/lib/python2.7/dist-packages/django/core/management/sql.py", line 9, in
from django.db import models
File "/usr/local/lib/python2.7/dist-packages/django/db/init.py", line 40, in
backend = load_backend(connection.settings_dict['ENGINE'])
File "/usr/local/lib/python2.7/dist-packages/django/db/init.py", line 34, in getattr
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 93, in getitem
backend = load_backend(db['ENGINE'])
File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 27, in load_backend
return import_module('.base', backend_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 17, in
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
i have tried giving extensions to db name in settings.py but it didn't work.
Please suggest what to do.
Thanks !
Or you can do:
sudo apt-get install python-mysqldb
Do you have mysql installed in you virtual environment
Try
pip install MySQL-python
I'm running the following commands and get the following error:
root# sudo python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/lib/pymodules/python2.6/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/lib/pymodules/python2.6/django/core/management/commands/syncdb.py", line 7, in <module>
from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
File "/usr/lib/pymodules/python2.6/django/core/management/sql.py", line 5, in <module>
from django.contrib.contenttypes import generic
File "/usr/lib/pymodules/python2.6/django/contrib/contenttypes/generic.py", line 6, in <module>
from django.db import connection
File "/usr/lib/pymodules/python2.6/django/db/__init__.py", line 77, in <module>
connection = connections[DEFAULT_DB_ALIAS]
File "/usr/lib/pymodules/python2.6/django/db/utils.py", line 91, in __getitem__
backend = load_backend(db['ENGINE'])
File "/usr/lib/pymodules/python2.6/django/db/utils.py", line 32, in load_backend
return import_module('.base', backend_name)
File "/usr/lib/pymodules/python2.6/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/lib/pymodules/python2.6/django/db/backends/mysql/base.py", line 14, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory
I have a feeling that mysqldb isn't configured properly with django, I was wondering if i'm missing anything. i ran the following commands right before it:
# apt-get install python-django
# apt-get install python-mysqldb
I had this same issue where my virtualenv was broken and could no longer run django when I upgraded to ubuntu 12.04.
I simply ran (while my ve was active)
pip uninstall MySQL-python
and then re-installed it with
pip install MySQL-python
worked fine again after that.