I've downloaded the pythonanywhere installation tool and am trying to deploy with the following line:
pa_autoconfigure_django.py <https://github.com/myusername/myproject.git>
Then, I get this a key error. My project runs on local.
File "/projects/hosproject/venv/lib/python3.7/site-packages/pythonanywhere/project.py", line 16, in __init__
self.virtualenv = Virtualenv(self.domain, self.python_version)
File "/projects/hosproject/venv/lib/python3.7/site-packages/pythonanywhere/virtualenvs.py", line 12, in __init__
self.path = Path(os.environ["WORKON_HOME"]) / domain
File "/projects/hosproject/venv/bin/../lib/python3.7/os.py", line 678, in __getitem__
raise KeyError(key) from None
KeyError: 'WORKON_HOME'
Need some help to debug this and try to deploy again. If it helps, I'm new to Django and following this tutorial: https://tutorial.djangogirls.org/en/deploy/.
As noted by Giles:
It looks like you might be running the PythonAnywhere tools from a terminal on your own machine -- you should run it in a bash console on PythonAnywhere -- you can start one from the "Consoles" page. (emphasis mine)
However I only got to this KeyError: WORKON_HOME after running several commands I shouldn't have (at least it'll make clean up easier):
$ pip3 install --user pythonanywhere
$ pa_autoconfigure_django.py --python=3.7 git#github.com:pzrq/djangogirls-tutorial-blog.git
-bash: pa_autoconfigure_django.py: command not found
$ find / -name "pa_autoconfigure_django.py"
$ /Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py --python=3.7 git#github.com:pzrq/djangogirls-tutorial-blog.git
Traceback (most recent call last):
File "/Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py", line 19, in <module>
from docopt import docopt
ModuleNotFoundError: No module named 'docopt'
$ pip install docopt
...
$ /Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py --python=3.7 git#github.com:pzrq/djangogirls-tutorial-blog.git
...
ModuleNotFoundError: No module named 'pythonanywhere'
$ pip install pythonanywhere
...
$ /Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py --python=3.7 git#github.com:pzrq/djangogirls-tutorial-blog.git
Traceback (most recent call last):
File "/Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py", line 52, in <module>
main(arguments['<git-repo-url>'], arguments['--domain'], arguments['--python'], nuke=arguments.get('--nuke'))
File "/Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py", line 33, in main
project = DjangoProject(domain, python_version)
File "/Users/pzrq/Projects/djangogirls/myvenv/lib/python3.7/site-packages/pythonanywhere/project.py", line 16, in __init__
self.virtualenv = Virtualenv(self.domain, self.python_version)
File "/Users/pzrq/Projects/djangogirls/myvenv/lib/python3.7/site-packages/pythonanywhere/virtualenvs.py", line 12, in __init__
self.path = Path(os.environ["WORKON_HOME"]) / domain
File "/usr/local/bin/../Cellar/python/3.7.3/bin/../Frameworks/Python.framework/Versions/3.7/lib/python3.7/os.py", line 678, in __getitem__
raise KeyError(key) from None
KeyError: 'WORKON_HOME'
Related
What I am trying to do: copy contents of a folder to a bucket. I have successfully done this in earlier versions of gsutil. Not sure if its the python version OR the gsutil version that caused this to break now. Any insights?
Command: gsutil -m cp -r . gs://target-bucket-url
Running: MacOS 10.15.5
Got the following error when trying the above command:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/managers.py", line 243, in serve_client
request = recv()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/connection.py", line 251, in recv
return _ForkingPickler.loads(buf.getbuffer())
File "/Users/user-x/tools/google-cloud-sdk/platform/gsutil/gslib/commands/cp.py", line 30, in <module>
from gslib.command import Command
File "/Users/user-x/tools/google-cloud-sdk/platform/gsutil/gslib/command.py", line 50, in <module>
from gslib.cloud_api_delegator import CloudApiDelegator
File "/Users/user-x/tools/google-cloud-sdk/platform/gsutil/gslib/cloud_api_delegator.py", line 26, in <module>
from gslib.cs_api_map import ApiMapConstants
File "/Users/user-x/tools/google-cloud-sdk/platform/gsutil/gslib/cs_api_map.py", line 23, in <module>
from gslib.gcs_json_api import GcsJsonApi
File "/Users/user-x/tools/google-cloud-sdk/platform/gsutil/gslib/gcs_json_api.py", line 72, in <module>
from gslib.third_party.storage_apitools import storage_v1_client as apitools_client
File "/Users/user-x/tools/google-cloud-sdk/platform/gsutil/gslib/third_party/storage_apitools/storage_v1_client.py", line 26, in <module>
class StorageV1(base_api.BaseApiClient):
File "/Users/user-x/tools/google-cloud-sdk/platform/gsutil/gslib/third_party/storage_apitools/storage_v1_client.py", line 38, in StorageV1
_USER_AGENT += gslib.USER_AGENT
AttributeError: module 'gslib' has no attribute 'USER_AGENT'
gsutil version: 4.51
python version: 3.8
This is a known issue and the Google team is taking a look at it at this issue tracker, I recommend you to go there and add more information if possible: AttributeError: module 'gslib' has no attribute 'USER_AGENT'
Setting python version to python 3.7 as suggested at the issue tracker worked for me. Below is the working configuration.
$ cat ~/.bash_profile
alias python='python3.7'
.....
$ source ~/.bash_profile
Whats I'll do ?
odoo#odoo-Aspire-ES1-572:~$ pip2 install pyboleto
Collecting pyboleto
Using cached pyboleto-0.3.1.tar.gz
Collecting distribute (from pyboleto)
Using cached distribute-0.7.3.zip
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/distribute.egg-info
writing requirements to pip-egg-info/distribute.egg-info/requires.txt
writing pip-egg-info/distribute.egg-info/PKG-INFO
writing top-level names to pip-egg-info/distribute.egg-info/top_level.txt
writing dependency_links to pip-egg-info/distribute.egg-info/dependency_links.txt
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-wdypyY/distribute/setup.py", line 58, in <module>
setuptools.setup(**setup_params)
File "/home/odoo/.pyenv/versions/2.7.12/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/home/odoo/.pyenv/versions/2.7.12/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/home/odoo/.pyenv/versions/2.7.12/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setuptools/command/egg_info.py", line 177, in run
writer = ep.load(installer=installer)
File "pkg_resources.py", line 2241, in load
if require: self.require(env, installer)
File "pkg_resources.py", line 2254, in require
working_set.resolve(self.dist.requires(self.extras),env,installer)))
File "pkg_resources.py", line 2471, in requires
dm = self._dep_map
File "pkg_resources.py", line 2682, in _dep_map
self.__dep_map = self._compute_dependencies()
File "pkg_resources.py", line 2699, in _compute_dependencies
from _markerlib import compile as compile_marker
ImportError: No module named _markerlib
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-wdypyY/distribute/
odoo#odoo-Aspire-ES1-572:~$ pip2 install _markerlib
Invalid requirement: '_markerlib'
Traceback (most recent call last):
File "/home/odoo/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 82, in __init__
req = Requirement(req)
File "/home/odoo/.local/lib/python2.7/site-packages/pip/_vendor/packaging/requirements.py", line 96, in __init__
requirement_string[e.loc:e.loc + 8]))
InvalidRequirement: Invalid requirement, parse error at "'_markerl'"
Please try the following:
sudo apt-get update # Fetches the list of available updates
sudo apt-get upgrade # Strictly upgrades the current packages
sudo apt-get dist-upgrade # Installs updates (new ones)
sudo pip install pyboleto
I'm trying to intall the asterisk_click2dial module on ODOO and this error comes to me in the log file:
ValueError: Routing: posting a message without model should be with a parent_id (private mesage).
2015-03-09 15:23:38,262 11093 ERROR ? werkzeug: Error on request:
Traceback (most recent call last):
File "/home/odoo/odoo/lib/python2.7/site-packages/werkzeug/serving.py", line 177, in run_wsgi
execute(self.server.app)
File "/home/odoo/odoo/lib/python2.7/site-packages/werkzeug/serving.py", line 165, in execute
application_iter = app(environ, start_response)
File "/opt/odoo/openerp/service/server.py", line 281, in app
return self.app(e, s)
File "/opt/odoo/openerp/service/wsgi_server.py", line 216, in application
return application_unproxied(environ, start_response)
File "/opt/odoo/openerp/service/wsgi_server.py", line 202, in application_unproxied
result = handler(environ, start_response)
File "/opt/odoo/openerp/http.py", line 1274, in __call__
self.load_addons()
File "/opt/odoo/openerp/http.py", line 1293, in load_addons
m = __import__('openerp.addons.' + module)
File "/opt/odoo/openerp/modules/module.py", line 79, in load_module
mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
File "/opt/odoo/addons/base_phone/__init__.py", line 23, in <module>
from . import wizard
File "/opt/odoo/addons/base_phone/wizard/__init__.py", line 23, in <module>
from . import number_not_found
File "/opt/odoo/addons/base_phone/wizard/number_not_found.py", line 25, in <module>
import phonenumbers
ImportError: No module named phonenumbers
The problem is just that I installed that module (phonenumbers) plus the py-Asterisk module without errors using pip install phonenumbers and pip install py-Asterisk and the error persists.
I noticed I have at least two versions of python installed (2.6 and 2.7) but both modules are installed at the same version from odoo (I can see the modules in the python2.7 cli when, for example, I write phonenumbers or search).
Has anybody any idea what is happening to me? I'd be gratefull for some specific response. Thanks.
Here the connector's page: OpenERP - Asterisk connector
Ok, my bad. During odoo instalation I created a virtual environment under the Odoo system user account which was used solely by the Odoo server so I just need to install these modules under that enviorment. This works for me:
First let’s switch from root to the odoo user, then create a new virtual environment called odoo and activate it:
su - odoo
/usr/local/bin/virtualenv --python=/usr/local/bin/python2.7 odoo
source odoo/bin/activate
(If you have the virtual environment created like me just ignore the second line). Before starting the module installation we need to add the path to the PostgreSQL binaries, otherwise the PsycoPG2 module install will fail (I ignored this one too):
export PATH=/usr/pgsql-9.3/bin:$PATH
Then I can do pip install... Thank you all for your help.
I have been trying to install Django correctly for a while to no avail.
C:\Python34\Scripts\pip.exe install C:\Python34\Lib\site-packages\Django-1.7.2\Django-1.7.2\setup.py
raises an exception and stores the following in a log file:
C:\Python34\Scripts\pip run on 01/12/15 17:47:02
Exception:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Python34\lib\site-packages\pip\commands\install.py", line 257, in run
InstallRequirement.from_line(name, None))
File "C:\Python34\lib\site-packages\pip\req.py", line 172, in from_line
return cls(req, comes_from, url=url, prereleases=prereleases)
File "C:\Python34\lib\site-packages\pip\req.py", line 70, in __init__
req = pkg_resources.Requirement.parse(req)
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources.py", line 2606, in parse
reqs = list(parse_requirements(s))
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources.py", line 2544, in parse_requirements
line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources.py", line 2512, in scan_list
raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', 'C:\\Python34\\Lib\\site-packages\\Django-1.7.2\\Django-1.7.2\\setup.py', 'at', ':\\Python34\\Lib\\site-packages\\Django-1.7.2\\Django-1.7.2\\setup.py')
any help would be greatly appreciated!
THANK YOU
For pip install refer to the directory containing setup.py.
C:\Python34\Scripts\pip.exe install C:\Python34\Lib\site-packages\Django-1.7.2\Django-1.7.2\
But since your path has site-packages in it already (e.g. C:\Python34\Lib\site-packages\) it would seem that it is already installed.
Other alternatives are:
pip install django==1.7.2
pip install django==1.7
python C:...\Django-1.7.2\setup.py install
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/Library/Python/2.7/site-packages/dj_static.py", line 83, in __call__
return self.application(environ, start_response)
File "/Library/Python/2.7/site-packages/django/core/handlers/wsgi.py", line 255, in __call__
response = self.get_response(request)
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 178, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 220, in handle_uncaught_exception
if resolver.urlconf_module is None:
File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 342, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/WillRedington/Desktop/Django Projects/propadev/propvocab/urls.py", line 3, in <module>
from rest_framework import routers
File "/Library/Python/2.7/site-packages/rest_framework/routers.py", line 23, in <module>
from rest_framework import views
File "/Library/Python/2.7/site-packages/rest_framework/views.py", line 11, in <module>
from rest_framework.compat import HttpResponseBase, View
File "/Library/Python/2.7/site-packages/rest_framework/compat.py", line 13, in <module>
from django.utils.six.moves.urllib import parse as urlparse
ImportError: No module named urllib
The server error message: [17/Dec/2014 16:26:45] "GET / HTTP/1.1" 500 59
This is checking if python returns the modules:
>>> import django.utils.six.moves
>>> import django.utils.six.moves.urllib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named urllib
>>>
My current python version is 2.7.2, Django is 1.5.1, rest framework is in 2.7 site-package.
I have already tried uninstalling and reinstalling Django several times and get the same error.
This is running on Mac OS X 10.9.5, please help me, I've been at this for 5 hours.
it seems like a dependency error. Maybe you downgraded your django, or randomly installed the rest framework package without controlling the dependencies.
django.utils.six.moves.urllib doesnt exist in django==1.5.1 yet. You can try to upgrade django to 1.5.7 for example. Then this import will work. Other things might still be broken though, I can´t tell from here. If you post the output of pip freeze here, it may be easier to help.
You aren´t working in a virtual environment, which is dangerous for dependencies. Best is to make a virtualenv, then install your packages with pip, taking care of dependencies.
Then run:
pip freeze > requirements.txt
and use that file in the future like this:
pip install -r requirements.txt
and edit the file accordingly if you install, update or remove packages.
Something that might be of interest is this: it generally never works to uninstall and reinstall the same package several times; if it doesn´t work once, it won´t work the second time either.
As someone mentioned before my response wasn't really an answer. I solved this error and potentially many more by installing a python virtual environment. To do this run the following
sudo pip install virtualenv
Then create a new folder for your virtual environments. cd into the created folder.
cd myvirtualenv
Then create a new virtual environment by running the following:
virtualenv venv
To run the virtual env:
source venv/bin/activate
This makes a seperate environment with it's own site packages, which is essential for any python developer, especially when working on multiple projects.
Source: http://docs.python-guide.org/en/latest/dev/virtualenvs/