Error occur when running with pypy
Wannawuth opened this issue · comments
Hello Nikolay,
Thank you for your sharing
My system is consisting of:
Hardware
Raspberry Pi3 Model B
Software
Linux raspberrypi 4.9.59-v7+ #1047
Python 2.7.13
Pypy2-v5.7.1-linux-armhf-raspbian
PyCNC can running with python. I test with command G1 and I get a low speed.
When pycnc running with pypy, an error occur as follow:
May I get your advice?
same here.
hardware rpi1 B+
$ uname -a
Linux pycnc 4.14.24+ #1097 Mon Mar 5 16:16:18 GMT 2018 armv6l GNU/Linux
$ pypy --version
Python 2.7.12 (5.6.0+dfsg-4+rpi1, Jan 10 2017, 23:40:22)
[PyPy 5.6.0 with GCC 6.2.1 20161124]
Starting with pypy
$ sudo pypy ./pycnc tests/speeds-x.gcode
---- ads111x is not detected ----
Traceback (most recent call last):
File "./pycnc", line 3, in <module>
import cnc.main
File "/home/pi/pycnc/PyCNC/cnc/main.py", line 10, in <module>
from cnc.gmachine import GMachine, GMachineException
File "/home/pi/pycnc/PyCNC/cnc/gmachine.py", line 4, in <module>
from cnc import hal
File "/home/pi/pycnc/PyCNC/cnc/hal.py", line 101, in <module>
from cnc.hal_raspberry.hal import *
File "/home/pi/pycnc/PyCNC/cnc/hal_raspberry/hal.py", line 12, in <module>
pwm = rpgpio.DMAPWM()
File "/home/pi/pycnc/PyCNC/cnc/hal_raspberry/rpgpio.py", line 290, in __init__
self._phys_memory.get_bus_address())
File "/home/pi/pycnc/PyCNC/cnc/hal_raspberry/rpgpio_private.py", line 139, in write_int
ctypes.c_uint32.from_buffer(self._memmap, address).value = int_value
File "/usr/lib/pypy/lib_pypy/_ctypes/basics.py", line 95, in from_buffer
result._ensure_objects()['ffffffff'] = obj
TypeError: 'NoneType' object does not support item assignment
Starting without pypy. Between the G1 codes are 3 to 4 seconds delays (round about). Pre calculating is slow but it works. 1/32 Micro stepping works well aside from the delays.
$ sudo ./pycnc tests/speeds-x.gcode
---- ads111x is not detected ----
> G90
OK
> G1 X100 F1500
OK
> G1 X0 F3000
OK
> G1 X100 F6000
OK
> G1 X0 F12000
OK
> G1 X100 F24000
OK
> G1 X0 F12000
OK
> G1 X100 F6000
OK
> G1 X0 F3000
OK
>
OK
Exiting...
well, seems to be a pypy bug up to <5.7 (and maybe again on 5.7.1???). I have tried to install 5.10 https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.10.0-linux-armhf-raspbian.tar.bz2 but got new errors about missing libs. As I updated the kernel via rpi-update to 4.14x (and I guess some libs) that may be the problem.
@Wannawuth could you try to install that pypy version instead of 5.7.1 on your machine and post the result?
sudo rm /usr/local/bin/pypy #removing old link from 5.7.1
sudo rm /opt/pypy/* #removing old pypy version in that directory
wget https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.10.0-linux-armhf-raspbian.tar.bz2
sudo tar xvf pypy2-v5.10.0-linux-armhf-raspbian.tar.bz2 --directory /opt/pypy/ --strip-components=1
sudo ln -s /opt/pypy/bin/pypy /usr/local/bin/pypy
PS: I have tested pycnc on rpi3 instead of rpi1, now. Much better!!!! :-)
Hello,
I used PyPy v5.7.1 and everything worked for me :) So try to install this version:
wget wget https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.7.1-linux-armhf-raspbian.tar.bz2
sudo mkdir /opt/pypy
sudo tar xvf pypy2-v5.7.1-linux-armhf-raspbian.tar.bz2 --directory /opt/pypy/ --strip-components=1
sudo ln -s /opt/pypy/bin/pypy /usr/local/bin/pypy
I was installed pypy2-v5.10.0
When pypy running, I get an error message: error while loading shared libraries: libssl.so.1.0.0 cannot open shared object file: No such file or directory
Then I was downloads and install libssl1.0.0_1.0.1t-1+deb8u7_armhf.deb
Now I get an error message: error while loading shared libraries: libffi.so.5: cannot open shared object file: No such file or directory
I think pypy v5.0+ can run pycnc.
Now problem is how to install pypy?
With my limited of the knowledge in linux, It may be please if someone can help!
@Wannawuth try sudo apt install libffi5
or sudo apt install libffi6
.
@Nikolay-Kha : Which version of raspbian/debian do you use? I am using stretch, not jessie. It has more up to date versions of libssl, libffi etc. May be that is the problem?
When use sudo apt install libffi5
result: E: Unable to locate package libffi5
When use sudo apt install libffi6
result: libffi6 is already the newest version (3.2.1-6).
0 upgraded, 0 newly installed, 0 to remove and 153 not upgraded.
Then run sudo pypy --version
result: pypy: error while loading shared libraries: libffi.so.5: cannot open shared object file: No such file or directory
After I manual install libffi5_3.0.10-3+deb7u2_armhf.deb
Now pypy can running and pycnc get better motor speed.
Thank you for all advise
@yo-k during development it was raspbian from the official web site https://www.raspberrypi.org/downloads/raspbian/
Image was downloaded one year ago, I don't remember exact version, but it was definitely jessie.
@Wannawuth I'm glad that you've managed to run it.
@Nikolay-Kha Thanks for answering. I am still trying to get pypy working with up to date libs but did not have enough time to dig deeper. I think it is a real pypy issue - not a pycnc issue. But I don't know.
@yo-k When pypy running, I get an error message: error while loading shared libraries: libssl.so.1.0.0 cannot open shared object file: No such file or directory
I was downloads a file libssl1.0.0_1.0.1t-1+deb8u7_armhf.deb from a link: http://ftp.nl.debian.org/debian/pool/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u7_armhf.deb)
Then I get a file: libssl1.0.0_1.0.1t-1+deb8u7_armhf.deb
Then manually install by running: sudo dpkg -i libssl1.0.0_1.0.1t-1+deb8u7_armhf.deb
Next run pypy, I get new error message: error while loading shared libraries: libffi.so.5: cannot open shared object file: No such file or directory
I was downloads a file libffi5_3.0.10-3+deb7u2_armhf.deb from a link:
http://ftp.nl.debian.org/debian-security/pool/updates/main/libf/libffi/libffi5_3.0.10-3+deb7u2_armhf.deb
Then I get a file: libffi5_3.0.10-3+deb7u2_armhf.deb
Then manually install by running: sudo dpkg –i libffi5_3.0.10-3+deb7u2_armhf.deb
Finally pypy is work!
@Wannawuth Thank you! It is a work around but depends on old security relevant libs.
@Nikolay-Kha Why do pycnc needs libssl? Or why is pypy checking for libssl?
@yo-k PyCNC don't need libssl. I think pypy needs it because it is probably dynamically linked with pypy binaries.