Python on different computers report failed assertion differently - python

On the remote server I run my code on Python does neither output the exact line of a failed assertion nor the following comment. On my local machine the output is as expected.
What is the reason for that? Do I need to install additional packages?
Remote server:
...
Traceback (most recent call last):
File "classify.py", line 48, in <module>
print "start reading files"
AssertionError
me#remoe:~/foo$ python --version
Python 2.7.2+
On my local machine:
...
start processing training data
Traceback (most recent call last):
File "classify.py", line 83, in <module>
assert(test_images == 0) # no test files found
AssertionError
me#local:~/foo$ python --version
Python 2.6.6
[Update]
The code on the server is the same as on the local machine as I mount my local hdd on my server.
I tried writing a minimal example, but it was to minimal, so that there was no effect. I will try to build an more extensive minimal example where the bug occurs.
Can somebody point me to a tutorial to install another python version w/o messing everything up.

Related

Installation of packages Pycharm 64-bit fails

I was previously on the path on working towards being able to obtain SEC 10K filings from Edgar, wherein I used a bloggers code for inspiration. When running this code in Pycharm 32-bit, I kept getting a "MemoryError" - which as far as I know is related to not having enough RAM (since 32-bit can only use 4GB).. I have 8GB of DDR3, so I figured if I installed Pycharm 64-bit, I should be ok!
However, when trying to set up the 64-bit version, and installing the same packages that I used previously in order to run the code again, I get the following error:
Collecting python-edgar
Using cached https://files.pythonhosted.org/packages/d0/5d/88b7c392cf9d69c61b418f9f5851292b52964fcde8f3116b2256e2fde5fa/python-edgar-2.3.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\PPB92\AppData\Local\Temp\pip-install-82zmyasf\python-edgar\setup.py", line 13, in <module>
long_description=read('README.md'),
File "C:\Users\PPB92\AppData\Local\Temp\pip-install-82zmyasf\python-edgar\setup.py", line 6, in read
return open(os.path.join(os.path.dirname(__file__), fname)).read()
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\PPB92\\AppData\\Local\\Temp\\pip-install-82zmyasf\\python-edgar\\README.md'
Does anyone know what I can do? I have very limited experience in programming, since I am a graduate student in finance and accounting..
It looks like there is problem in library itself, i have raised the issue on git.
For now you can do:
git clone git#github.com:edouardswiac/python-edgar.git
in your site-packages and under python-edgar folder run :
python setup.py install

Error installing pyflycapture2 on Windows

I am attempting to install this https://github.com/jordens/pyflycapture2 python binding on my Windows machine. The readme only has instructions on how to do it for Linux systems, but I imagine the library should still work.
I am able to run "python setup.py install" and it seems to successfully complete, but when I try to run "python test_flycapture2.py" I get this error:
C:\Users\clinic\Desktop\pyflycapture2>python test_flycapture2.py Traceback (most recent call last):
File "test_flycapture2.py", line 20, in <module>
import flycapture2 as fc2
File "build\bdist.win-amd64\egg\flycapture2.py", line 7, in <module>
File "build\bdist.win-amd64\egg\flycapture2.py", line 6, in __bootstrap__
ImportError: DLL load failed: The specified module could not be found.
This seems to imply that flycapture2 wasn't installed correctly. When I instead just open a python session and do "import flycapture2" I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build\bdist.win-amd64\egg\flycapture2.py", line 7, in <module>
File "build\bdist.win-amd64\egg\flycapture2.py", line 6, in __bootstrap__
ImportError: DLL load failed: The specified module could not be found.
Have I done something wrong with the installation process or does pyflycapture2 just not work with Windows?
A dumb solution that's worth a try. There are chances that the DLL are searched directly from where you're starting the python script. So if you have the dll somewhere on your computer, copy it along where you have your test_flycapture2.py.
But given the fact that the setup.py file has a whole bunch of absolute paths in there, I would not place my hopes too high. You can also try to install FlyCapture 2 at the exact same path, run python setup.py bdist_wheel (you will need to install wheel first with pip) in the pyflycapture2 folder, and see if that succeeds.
If it does, try installing the generated wheel (that will be in dist/ subfolder) by doing pip install dist/pyfly....wheel and test again.
Hope this helps
I'm answering this mostly because I found another post where the same question had been posted but the original problem was never answered.
How do I run an installed Python module on Windows?
In the comments, the original poster says that it suddenly started working. I found that the solution was simply to restart my computer. I have now attempted this on two computers and this worked for both of them.

Chirp Running on Maemo

I'm trying to get Chirp to run under Maemo5 (a debian based mobile operating system).
When running .chirpw or setup.py I get this as a result
Nokia-N900:~/compile/chirp-0.3.1# ./chirpw
CHIRP 0.3.1 on Linux - Maemo 5 %h (Python 2.5.4)
Traceback (most recent call last):
File "./chirpw", line 105, in <module>
from chirp import *
File "/root/compile/chirp-0.3.1/chirp/icq7.py", line 50
class ICQ7Radio(icf.IcomCloneModeRadio):
^
SyntaxError: invalid syntax
I am using the chirp source found here: http://chirp.danplanet.com/download/0.3.1/chirp-0.3.1.tar.gz
The idea is to be able to program my radios from my linux powered phone, however I can't seem to figure out why the program is getting held up on the ICQ7Radio class.
Any help/pointers would be much appreciated.
That version is quite old, have a try with latest daily build http://trac.chirp.danplanet.com/chirp_daily/LATEST/
You can also download full hg repository with
hg clone http://d-rats.com/hg/chirp.hg
See also http://chirp.danplanet.com/projects/chirp/wiki/Developers

Minecraft 1.5.2 MCP

I have a PowerPC Mac that is runing 10.5.8 mac OSX and has 2.5.1 python. When I try to run any file from the MCP folder that i download i get this error:
Macintosh-2:MCP Rosty$ bash
bash-3.2$ /Users/Rosty/Documents/MCP/updatemcp.sh
/Users/Rosty/Documents/MCP/runtime/commands.py:137: Warning: 'with' will become a reserved keyword in Python 2.6
Traceback (most recent call last):
File "runtime/updatemcp.py", line 13, in
from commands import Commands
File "/Users/Rosty/Documents/MCP/runtime/commands.py", line 137
with open(csvfile, 'rb') as fh:
^
SyntaxError: invalid syntax
I have looked on the net but no one has the same problem... can some one plzzz help ???
From the wiki: http://mcp.ocean-labs.de/index.php/MCP_Releases
You need to update Python to 2.7
edit: A simple google search confirms, http://www.minecraftforum.net/topic/1752529-mcp-error/

JPype won't compile properly

So I am having trouble compiling a very simple python script using JPype.
My code goes like:
from jpype import *
startJVM(getDefaultJVMPath(), "-ea")
java.lang.System.out.println("hello world")
shutdownJVM()
and when I run it I receive an error saying:
Traceback (most recent call last): File "test.py", line 2, in
<module>
startJVM(getDefaultJVMPath(), "-ea") File "/usr/lib/pymodules/python2.7/jpype/_core.py", line 44, in startJVM
_jpype.startup(jvm, tuple(args), True) RuntimeError: Unable to load DLL [/usr/java/jre1.5.0_05/lib/i386/client/libjvm.so], error =
/usr/java/jre1.5.0_05/lib/i386/client/libjvm.so: cannot open shared
object file: No such file or directory at
src/native/common/include/jp_platform_linux.h:45
I'm stuck and I really need help. Thanks!
I had the same problem
RuntimeError: Unable to load DLL [/usr/java/jre1.5.0_05/lib/i386/client/libjvm.so], error = /usr/java/jre1.5.0_05/lib/i386/client/libjvm.so: cannot open shared object file: No such file or directory at src/native/common/include/jp_platform_linux.h:45
In my case wrong JAVA_HOME path was set
/profile/etc
export JAVA_HOME
JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
PATH="$JAVA_HOME/bin:$PATH"
export PATH
The work around is to define the full path directly in the call to the JVM:
from jpype import *
startJVM('/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/MacOS/libjli.dylib', "-ea", "-Djava.class.path=/tmp/Jpype/sample")
java.lang.System.out.println("Hello World!!")
shutdownJVM()
Original text:
Similar issues when trying to run JPype on MacOS El Capitan. I could
not figure out how to coax the _darwin.py code finding the correct JVM
location, despite the JAVA_HOME system variable being set properly.
Caveat cursor, trying to run the above code in the Spyder IPython console did not produce any output, but the normal Console would.

Categories

Resources