Web2py Error:
<type 'exceptions.RuntimeError'> Failure to connect, tried 5 times:
Traceback (most recent call last): File
"/Applications/web2py.app/Contents/Resources/gluon/packages/dal/pydal/base.py",
line 446, in __init__ File
"/Applications/web2py.app/Contents/Resources/gluon/packages/dal/pydal/adapters/base.py", line 60, in __call__ File
"/Applications/web2py.app/Contents/Resources/gluon/packages/dal/pydal/adapters/mongo.py",
line 91, in __init__ Exception: pydal requires pymongo version >= 3.0, found '2.2.1'
Version web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
Python:
python
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 5 2015, 21:12:44)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymongo
>>> pymongo.version
'3.3.0'
>>>
Environment: OSX
Can someone help in resolving Web2py error?
It looks like you are running the OSX binary version of web2py, which comes with its own Python 2 interpreter (currently, web2py runs under Python 2 only), so it will ignore your system's Python installation (and web2py wouldn't run under your Python 3 installation anyway). The web2py binary version does not come with pymongo, so I'm not sure where that pymongo version 2.2.1 has come from, unless you installed it yourself in /web2py.app/Contents/Resources/site-packages.
One option is to install Python 2.7, install pymongo, and then download the source version of web2py instead of the OSX binary.
Related
I use a Gentoo-based Docker image for CI with multiple versions of Python. Recently, I've started experiencing errors because one tool (coveralls) requires sqlite, which is missing. sqlite is part of the Python standard library.
This can be checked from the command line
>>> removing all .pyc files
>>> executing command
me#5b35f99c08af /source $ python
Python 3.6.9 (default, Dec 27 2019, 12:15:49)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'sqlite3'
I couldn't find any notes in the Gentoo packaging database about this, but I'm not really familiar with it as an OS. I assume there must have been a problem building some relevant library.
Python has been installed like this:
RUN emerge -q -u dev-lang/python:3.6
But the error occurs for all the versions I'm currently testing with: >= 3.5. Any ideas as to what I'm doing wrong?
I have been using jpype to integrate with some java code using python lately and have been having no real issues. I am now attempting to set up my stack on a new system and am running into difficulties.
I am running 32-bit Python 3.6.5 and 32-bit oracle Java 1.8 update 171. Python and jpype have been installed using conda (conda create -n venv -c conda-forge python jpype1 arrow), and
jpype.getDefaultJVMPath() returns the expected path (C:\Program Files (x86)\Java\jre1.8.0_171\bin\client\jvm.dll), however an exception is raised stating that it could not find the module. The output from the python console below.
Python 3.6.5 | packaged by conda-forge | (default, Apr 6 2018, 16:13:16) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import jpype
>>> import os
>>> jpype.__version__
'0.6.3'
>>> jvm_path=jpype.getDefaultJVMPath()
>>> jvm_path
'C:\\Program Files (x86)\\Java\\jre1.8.0_171\\bin\\client\\jvm.dll'
>>> os.path.exists(jvm_path)
True
>>> jpype.startJVM(jvm_path)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\User\AppData\Local\conda\conda\envs\venv\lib\site-packages\jpype\_core.py", line 70, in startJVM
_jpype.startup(jvm, tuple(args), True)
RuntimeError: Unable to load DLL [C:\Program Files (x86)\Java\jre1.8.0_171\bin\client\jvm.dll], error = The specified module could not be found.
at native\common\include\jp_platform_win32.h:58
>>>
What am I missing and/or doing wrong here?
In digging thru differences between the3 windows systems that I have been working on (2 working and this one that was not working) I found that the Microsoft Visual C++ 2010 Redistributable Package (x86) had been installed on the previous 2 systems but not the one exhibiting this behavior.
Installing the C++ redistributable immediately corrected the issue.
I am trying to install GLPK python module to work on linear programming from a different angle but I am not getting it right. can some one tell me what is it that I am missing?
Here is the error in detail:
Python 2.7.10 |Anaconda 2.3.0 (x86_64)| (default, May 28 2015, 17:04:42)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> import glpk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda/lib/python2.7/site-packages/glpk/__init__.py", line 26, in <module>
from glpk_parser import *
File "//anaconda/lib/python2.7/site-packages/glpk/glpk_parser.py", line 352, in <module>
yacc.yacc(write_tables=0, debug=0)
File "//anaconda/lib/python2.7/site-packages/ply/yacc.py", line 3244, in yacc
read_signature = lr.read_table(tabmodule)
File "//anaconda/lib/python2.7/site-packages/ply/yacc.py", line 1967, in read_table
if parsetab._tabversion != __tabversion__:
AttributeError: 'module' object has no attribute '_tabversion'
I followed instructions as shown in the link
I searched the web for some solutions and some solutions said that there must be a version mismatch, but I am not sure if that is the same for me as well.
I also installed glpk version 4.35 with the following instructions :
Tar -xvf [filename]
./configure
Make
Make install
This will install
Glpsol --help
Once installed
[Though I am not sure of there is a connection made]
can someone please help me out?
So I can confirm that this is a version mismatch. Since python glpk is not that well maintained it became a little incompatible with ply.
What is happening here is that ply is getting initialized without any specific written model. It will automatically load parsetab.py which lacks the needed attribute _tabversion.
So you can probably add a _tabversion = '3.10' (newest ply version) to parsetab, which should create the needed attribute. On the other hand you can use the ply version which was used during development of python glpk (old 3.4 version) which has some additional compatibility paths for those old module files.
Last option would be to use a better maintained implementation of glpk-bindings for python (at University we used glpk via pyomo in python for our students)
I've recently given up on macports and gone to homebrew. I'm trying to be able to import numpy and scipy. I seem to have installed everything correctly, but when I type python in terminal, it seems to run the default mac python.
I'm on OSX 10.8.4
I followed this post: python homebrew by default
and tried to move the homebrew directory to the front of my %PATH by entering
export PATH=/usr/local/bin:/usr/local/sbin:~/bin:$PATH
then "echo $PATH" returns
/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin
however when I look for where my python is by "which python", I get
/usr/bin/python
For some reason when I import numpy in interpreter it works but not so for scipy.
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import scipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named scipy
>>>
What do I need to do to get python to run as my homebrew-installed python? Should this fix my problem and allow me to import scipy?
Homebrew puts things in a /usr/local/Cellar/<appname> directory, if I'm not mistaken. You should find the bin of the python in there and put it in your path before hitting /usr/bin.
For example, on my 10.8, python is located at /usr/local/Cellar/python/2.7.5/bin and I put that directory before /usr/bin/python in my PATH variable.
I do that similarly for other instances of me wanting to use homebrew version of an app, another example being sqlite.
I want to have Z3python on my Ubuntu 12.04 64-bit. I downloaded Z3 source, and compiled like below:
$autoconf
$./configure
$sudo make
$sudo make a
$sudo make o
Everything went well, but then I tried:
$ python
Python 2.7.3 (default, Sep 26 2012, 21:51:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import z3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named z3
It seems Z3python is not installed yet? I followed exactly the instructions in README, but it seems to miss something regarding Python binding?
please ignore, what i got is the old version of Z3.
a recommendation: please provide the source code of the latest Z3 in the homepage. i couldnt find it anywhere, then wrongly got the old version. finally, i had to download the latest version from the SourceControl, which was a bit tricky.