python + how to install the module web.py - python

I installed on my XP machine the python version - 3.4.0
and now I want to install the web.py module
the installation is failed on print "var", var
I guess is because the missing "(" , ")"
but how to fix that?
C:\Python34\Scripts>pip install web.py
Downloading/unpacking web.py
Running setup.py (path:D:\DOCUME~1\uba\LOCALS~1\Temp\pip_build_uba\web.p
y\setup.py) egg_info for package web.py
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "D:\DOCUME~1\ubarih\LOCALS~1\Temp\pip_build_uba\web.py\setup.py",
line 6, in <module>
from web import __version__
File "D:\DOCUME~1\uba\LOCALS~1\Temp\pip_build_uba\web.py\web\__init_
_.py", line 14, in <module>
import utils, db, net, wsgi, http, webapi, httpserver, debugerror
File "C:\Python34\lib\site-packages\db\__init__.py", line 69
print "var", var
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "D:\DOCUME~1\uba\LOCALS~1\Temp\pip_build_uba\web.py\setup.py", line
6, in <module>
from web import __version__
File "D:\DOCUME~1\ubarih\LOCALS~1\Temp\pip_build_uba\web.py\web\__init__.py
", line 14, in <module>
import utils, db, net, wsgi, http, webapi, httpserver, debugerror
File "C:\Python34\lib\site-packages\db\__init__.py", line 69
print "var", var
^
SyntaxError: invalid syntax
----------------------------------------
Cleaning up...

You installed Python 3.4 on your machine, but web.py does not support Python3.X.
If you look at the source, you see that there is a branch in the git, but the migration seemed to be incomplete. (https://github.com/webpy/webpy/tree/python3/web).
There was also a discussion about the migration (https://groups.google.com/forum/#!topic/webpy/NvDqKEEEMEI).
Install the development branch
You can try this branch by downloading the source from github
(https://github.com/webpy/webpy/archive/python3.zip). After you downloaded the file, extract it and run the setup-script
setup.py install
from a python command prompt (assuming you are on Windows).
But there is no guarantee that this version will work as expected.
As an (easier?) alternative:
If you want to use web.py, try to install python 2.7.x (https://www.python.org/downloads/release/python-2710/) and install web.py via pip afterwards.

Related

How to install Python 2.7 on Ubuntu 9.10

Now we're developing our software on the customer side, and there is:
maestro#UIServer:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.10
DISTRIB_CODENAME=karmic
DISTRIB_DESCRIPTION="Ubuntu 9.10"
system is installed. We're not allowed to upgrade this system to a newer version, but we need to use Python 2.7 in our project.
E.g. we have to use pymorphy2 package, but when we're trying to import it into project, we get:
>>> import pymorphy2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/pymorphy2/__init__.py", line 3, in <module>
from .analyzer import MorphAnalyzer
File "/usr/local/lib/python2.7/site-packages/pymorphy2/analyzer.py", line 10, in <module>
from pymorphy2 import opencorpora_dict
File "/usr/local/lib/python2.7/site-packages/pymorphy2/opencorpora_dict/__init__.py", line 4, in <module>
from .storage import load_dict as load
File "/usr/local/lib/python2.7/site-packages/pymorphy2/opencorpora_dict/storage.py", line 24, in <module>
from pymorphy2.utils import json_write, json_read
File "/usr/local/lib/python2.7/site-packages/pymorphy2/utils.py", line 5, in <module>
import bz2
ImportError: No module named bz2
Ok, we're trying to install libbz2-dev:
sudo apt-get install libbz2-dev
end getting this:
ValueError: /usr/bin/python does not match the python default version. It must be reset to point to python2.6
dpkg: error processing python-pip (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
python-pip
E: Sub-process /usr/bin/dpkg returned an error code (1)
How to avoid this problem?
Thanks in advance!
Download python, build and install using :
$ ./configure
$ make
$ make install
I am assuming you have build-essential installed or at least gcc. You can customize installation by passing prefix=/path/where/you/want/python/installed and other flags to make.

CKAN installation errors: Sites ckan_default and datapusher do not exist

I am trying to install CKAN onto Ubuntu 13.10. (64bit) following these instructions. Python 2.7.5+ is installed on the machine. The following errors stop me from installing the CKAN package:
$ sudo dpkg -i python-ckan_2.2_amd64.deb
Selecting previously unselected package python-ckan.
(Reading database ... 289528 files and directories currently installed.)
Unpacking python-ckan (from python-ckan_2.2_amd64.deb) ...
Setting up python-ckan (2.2-1) ...
Traceback (most recent call last):
File "/usr/lib/ckan/default/bin/paster", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/ \
distribute-0.6.24-py2.7.egg/pkg_resources.py", line 16, in <module>
import sys, os, zipimport, time, re, imp, types
File "/usr/lib/ckan/default/lib/python2.7/re.py", line 105, in <module>
import sre_compile
File "/usr/lib/ckan/default/lib/python2.7/sre_compile.py", line 14, in <module>
import sre_parse
File "/usr/lib/ckan/default/lib/python2.7/sre_parse.py", line 17, in <module>
from sre_constants import *
File "/usr/lib/ckan/default/lib/python2.7/sre_constants.py", line 18, in <module>
from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
System start/stop links for /etc/init.d/nginx already exist.
System start/stop links for /etc/init.d/apache2 already exist.
ERROR: Site ckan_default does not exist!
ERROR: Site datapusher does not exist!
Finally, I installed CKAN from source as suggested by the documentation:
This is the quickest and easiest way to install CKAN, but it requires Ubuntu 12.04 64-bit.

python3 in a virtualenv still uses library in /usr/lib/python2.7/dist-packages

I have successfully created a virtual environment with virtualenvwrapper using python3 at /usr/local/bin/python3 as default interpreter. My system python is python2.7
I can't use pip3 in this virtual environment because it keeps looking inside the default /usr/lib/python2.7/dist-packages
(python3.3.3)╭ ➜ xxx#xxx:~VIRTUAL_ENV/bin
╰ ➤ pip3.3
Traceback (most recent call last):
File "/home/xxx/virtualenv/python3.3.3/bin/pip3.3", line 7, in <module>
from pip import main
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 11, in <module>
from pip.basecommand import command_dict, load_command, load_all_commands, command_names
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 11, in <module>
from pip.baseparser import parser, ConfigOptionParser, UpdatingDefaultsHelpFormatter
File "/usr/lib/python2.7/dist-packages/pip/baseparser.py", line 5, in <module>
import pkg_resources
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 45
def _bypass_ensure_directory(name, mode=0777):
^
SyntaxError: invalid token
Am I forgetting something?
I've also tried to install python3 into a custom directory inside /opt but that doesn't help.
Got it. My system $PYTHONPATH contains /usr/lib/python2.7/dist-packages so I simply removed it from the path and everything is now working properly.

Error when building a project

I cloned an organism project from github.
I tried to install it, but there is no one setup.py file and no documentation.
Could you advise me how to correctly build and install it under Ubuntu 12.04?
I tried so far:
sudo python3 organism.setup.py install
which shows error message:
byte-compiling /usr/local/lib/python3.2/site-packages/organism/coreaux/configuration.py to configuration.pyc
File "/usr/local/lib/python3.2/site-packages/organism/coreaux/configuration.py", line 31
_USER_FOLDER_PERMISSIONS = 0750
^
SyntaxError: invalid token
and running it shows this error message:
$ organism
Traceback (most recent call last):
File "/usr/local/bin/organism", line 23, in <module>
organism.main()
File "/usr/local/lib/python3.2/site-packages/organism/__init__.py", line 21, in main
import coreaux
ImportError: No module named coreaux
I'm not sure if I should use all the files organism-development.setup.py, organism-organizer.setup.py, organism.setup.py, organism-tk.setup.py in the build process or the error is elsewhere.

python-daemon install failure

I installed Python3.3 as non-root user, and use pip from python virtualenv to install beaver, a python module depends on python-daemon. However the install failure because python-daemon can not be installed.
(py_virtual)[infra#sulog01 beaver-master]$ pip install beaver==22
Downloading/unpacking beaver==22
Downloading Beaver-22.tar.gz (40kB): 40kB downloaded
Running setup.py egg_info for package beaver
Downloading/unpacking pika>=0.9.5 (from beaver==22)
Downloading pika-0.9.9.tar.gz (56kB): 56kB downloaded
Running setup.py egg_info for package pika
Downloading/unpacking python-daemon>=1.5.2 (from beaver==22)
Downloading python-daemon-1.6.tar.gz (41kB): 41kB downloaded
Running setup.py egg_info for package python-daemon
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/home/infra/logstash/beaver_Python/beaver-
master/py_virtual/build/python-daemon/setup.py", line 22, in
<module>main_module = __import__(main_module_name,
fromlist=['version'])
File "./daemon/__init__.py", line 42, in <module>
from . import version
File "./daemon/version/__init__.py", line 16, in <module>
from .version_info import version_info
File "./daemon/version/version_info.py", line 21
print 'revision: %(revno)d' % version_info
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/home/infra/logstash/beaver_Python/beaver-master/
py_virtual/build/python-daemon/setup.py", line 22, in <module>
main_module = __import__(main_module_name, fromlist=['version'])
File "./daemon/__init__.py", line 42, in <module>
from . import version
File "./daemon/version/__init__.py", line 16, in <module>
from .version_info import version_info
File "./daemon/version/version_info.py", line 21
print 'revision: %(revno)d' % version_info
^
SyntaxError: invalid syntax
----------------------------------------
Command python setup.py egg_info failed with error code 1 in
/home/infra/logstash/beaver_Python/beaver-master/py_virtual/
build/python-daemon
Storing complete log in /home/infra/.pip/pip.log
Do I need to install anything else before install python-daemon? Or is this issue with Python3.3 itself?
Looks like beaver and python-daemon don't support Python 3 at this point. You'll have to use Python 2.x.

Categories

Resources