pyrpl-fpga / pyrpl

pyrpl turns your RedPitaya into a powerful DSP device, especially suitable as a lockbox in quantum optics experiments.
http://lneuhaus.github.io/pyrpl/
MIT License
139 stars 110 forks source link

Enable simple install #530

Closed peteasa closed 1 week ago

peteasa commented 2 weeks ago

Lets try this! Here are a couple of commits that make it possible for me to use this repo.

First ssh access fails if there are multiple keys in the .ssh host folder. Failure: Received disconnect from 192.169.0.119 port 22:2: Too many authentication failures

This can be observed on the command line with: ssh -v root@rp-xxxxxx

The fix on the command line is to use:

ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PreferredAuthentications=password -o PubkeyAuthentication=no root@rp-xxxxxx

With paramiko module the fix is to add look_for_keys=False and allow_agent=False to the connect Second For me on Ubuntu 24.04 pip installs are broken. I if you want to use pip then you have to add an additional parameter to the command line - python3 -m pip install --break-system-packages it is possible to run pyrpl without install. So if your project python code has "import pyrpl" and your directory structure is: `` $ ln -s ../pyrpl/pyrpl pyrpl

$ ls -als project.py pyrpl -> ../pyrpl/pyrpl `` then this fix enables you to import the pyrpl code without installing pyrpl. All you need to do is clone the latest pyrpl repository into the base folder of your project and create the symbolic link from pyrpl/pyrpl to your project folder.

This change works for python2 and python3

Here is a stack exchange discussion of this change https://stackoverflow.com/questions/52516849/use-init-py-to-modify-sys-path-is-a-good-idea

peteasa commented 2 weeks ago

Note the pyrpl-fpga:main does not currently support the v2.0 fpga update process. Specifically the following command is not supported

self.ssh.ask('cat '
                 + os.path.join(self.parameters['serverdirname'], self.parameters['serverbinfilename'])
                 + ' > //dev//xdevcfg')

So to test these changes I added my update_fpga.sh script ( a copy of the new /opt/redpitaya/sbin/overlay.sh ) script to get my version of this branch to work with the fpga from this branch.

md5sum //opt//pyrpl//fpga.bin
c8dee7ec782cadeb6af7184a09176a3c  //opt//pyrpl//fpga.bin
root@rp-f0bd75:~# 
md5sum fpga.bin: md5sum //opt//pyrpl//fpga.bin
c8dee7ec782cadeb6af7184a09176a3c  //opt//pyrpl//fpga.bin
root@rp-f0bd75:~# 
//opt//pyrpl//update_fpga.sh pyrpl

When I added all my other changes I got the nose test results of: Ran 503 tests in 653.871s FAILED (failures=4)

The test log stdio output is attached nose_stdio_241107.log

JohannesWes commented 2 weeks ago

Hi @peteasa, which RP OS version and specific python version are you using with this branch? With this version, I don't need "python setup.py develop" anymore and I just start pyrpl via "python -m pyrpl your_configuration_name", after creating the symbolic links? And you're using anaconda? I think I'm a bit confused between the installation instruction in the readme and the installation instruction in your testbench repo/the one in your comment above.

peteasa commented 2 weeks ago

Step by step instructions for "simple install" using Ubuntu 24.04 LTS: First setup RedPitaya using the "normal" installation process for v0.94 - 2.00-37 - Branch 2024.3 see - https://redpitaya.readthedocs.io/en/latest/quickStart/SDcard/SDcard.html

@rp-xxxxxx:~$ cat /opt/redpitaya/version.txt
Red Pitaya GNU/Linux Ecosystem
Version: 2.00-a0457d3aa
Build: 37
Branch: 
Commit: a0457d3aa595ca790b8c4386990f963f775e6c03
U-Boot: "redpitaya-v2022.1"
Linux Kernel: "branch-redpitaya-v2024.1"
Pro Applications: ""

Next on ubuntu host install the necessary python3 packages used by pyrpl:

sudo apt install python3-ipython python3-numpy python3-pandas python3-scp python3-paramiko python3-scipy python3-ruamel.yaml python3-qtpy python3-qasync python3-pyqtgraph python3-nest-asyncio python3-matplotlib python3-yaml

Next create your project directory and link to the pyrpl library

git clone https://github.com/pyrpl-fpga/pyrpl
mkdir myproject
cd myproject
ln -s ../pyrpl/pyrpl .

Now you are set to create python3 code or create .ipynb files in your project folder and connect using import pyrpl.

Note that this merge is the first of several that I plan to do over the next few days. Once all these merges are completed this will work. Right now all that this commit achieves is the simple install where you can import from a library in your source path.

There are other install processes that may work better for you. In my case this is simple and easy so I have no need for other python package managers or virtual environments.

This branch is work in progress.. so not the best branch to use for your work right now.

peteasa commented 2 weeks ago

Hi @JohannesWes and for anyone else who is looking for a "quick fix" for python3 with the latest version 2.0 fpga I have published a temporary branch with all my changes to date https://github.com/peteasa/pyrpl/tree/consolidate_python3.. some of these will end up on the main line some will not. I am working on custom fpga for pyrpl at the moment as you will see from the WIP commit on consolidate_python3 branch. FYI my nose testing of this branch produces a result of: Ran 503 tests in 636.110s FAILED (failures=5) so most of it works. Please any discussions about the "personal" consolidate_python3 branch please feel free to ask at https://github.com/peteasa/pyrpl/discussions

peteasa commented 1 week ago

@michaelcroquette how do I get the review done for this pull request. This pull request should be no problem and should work with both python2 and python3 code.

michaelcroquette commented 1 week ago

Hello, sorry for the delay ! If you have tested this then I can approve it. Thanks ! I want to test the modifications for the v2.0 fpga update before pulling them to the main branch. Don't have a lot of time to do so right now.

peteasa commented 1 week ago

@michaelcroquette On the modifications for the v2.0 branch I have a problem with them as I mentioned in the comment. I also have a solution https://github.com/peteasa/pyrpl/commit/84497a6864ead444089d39c3c14682f0d63b916e if you would like to review that.