Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module 'pyrealsense2' has no attribute 'pipeline' #6986

Closed
Kosta404 opened this issue Jul 31, 2020 · 24 comments
Closed

Module 'pyrealsense2' has no attribute 'pipeline' #6986

Kosta404 opened this issue Jul 31, 2020 · 24 comments

Comments

@Kosta404
Copy link

Kosta404 commented Jul 31, 2020

Required Info
Camera Model SR300
Firmware Version 2.36
Operating System & Version Raspberry Pi OS (32-bit) release 2020-05-27
Kernel Version (Linux Only) 5.4.51
Platform Raspberry Pi/.
SDK Version legacy / 2.36.0
Language python
Segment others

Issue Description

I`ve installed pyrealsense through this guide https://github.com/acrobotic/Ai_Demos_RPi/wiki/Raspberry-Pi-4-and-Intel-RealSense-D435. Before reinstalling the system it worked well. Now it says "Attribute error module 'pyrealsense2' has no attribute 'pipeline' "

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jul 31, 2020

Hi @Kosta404 I see that Raspberry Pi OS is the new name for the Raspbian OS, and that Raspberry Pi OS should work with all Pi models,

May I confirm that you are using the Pi 4 model please, as suggested by your acrobotic link? Thanks!

@Kosta404
Copy link
Author

Kosta404 commented Aug 3, 2020

@MartyG-RealSense Hello! Yes, I`m using Raspberry Pi 4.

@MartyG-RealSense
Copy link
Collaborator

Thank you very much. I recall that the Acrobotic installation guide that you used is quite similar to Intel's official installation guide for the Pi 3 / 3b.

https://github.com/IntelRealSense/librealsense/blob/master/doc/installation_raspbian.md

I notice that you said that you "reinstalled" the system. Have you had pyrealsense2 installed on your computer before, please?

@Kosta404
Copy link
Author

Kosta404 commented Aug 3, 2020

@MartyG-RealSense Yes, I`ve had it installed on Pi. But I reinstalled my system on a new SD-card.

@MartyG-RealSense
Copy link
Collaborator

Unfortunately, getting pyrealsense2 to work on a Raspberry Pi can sometimes be an awkward process. I have a memory of a case where a Pi user installed it successfully, backed up their system to SD card and reinstalled from the card but pyrealsense2 no longer worked. It may be that your pyrealsense2 setup will have to be recreated the long way around (build librealsense, then build pyrealsense2).

@Kosta404
Copy link
Author

Kosta404 commented Aug 3, 2020

@MartyG-RealSense Dont close the topic please. Ill write here after reinstall. Thank you

@MartyG-RealSense
Copy link
Collaborator

Okay, good luck!

@Kosta404
Copy link
Author

Kosta404 commented Aug 3, 2020

@MartyG-RealSense Hi again . I`ve reinstalled pyrealsense2 and librealsense packages. And built them again according to the official guide suggested above.

That didn`t work. I have the same problem, not only pipeline function but all the pyrealsense2 functions are not available.
But if i import pyrealsense2 there is no errors in console.
Here is a screensht of what I get after pressing TAB
Screenshot from 2020-08-03 15-34-31

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Aug 3, 2020

Thank you very much for your patience.

In the Pi instructions for building pyrealsense2, it provides two separate instructions for building pyrealsense2 for Python 2 and for Python 3. Have you tried only using the install instruction that applies to the Python version you have installed on your Pi? If you have Python 2.7, only use the Python 2 instruction, and if you have a Python 3 version, only use the Python 3 install instruction. But not both of them.

@Kosta404
Copy link
Author

Kosta404 commented Aug 3, 2020

@MartyG-RealSense I`ve installed only for python3. pyrealsense2 can not be imported for python2. realsense-viewer though works fine.

@MartyG-RealSense
Copy link
Collaborator

I believe that if you only have Python 3 installed and not Python 2 then you can leave the -DPYTHON_EXECUTABLE command out of the CMake statement. Some users have had failed pyrealsense2 builds when including this command.

@Kosta404
Copy link
Author

Kosta404 commented Aug 3, 2020

I believe that if you only have Python 3 installed and not Python 2 then you can leave the -DPYTHON_EXECUTABLE command out of the CMake statement. Some users have had failed pyrealsense2 builds when including this command.

No, I have both python2 and python3 installed by default on my system.

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Aug 3, 2020

Okay, so you should include -DPYTHON_EXECUTABLE then, as it tells CMake which Python version to install the bindings in.

For some people, using the version of DYPTHON_EXECUTABLE below has worked (i.e three full stops after the equals sign):

-DPYTHON_EXECUTABLE=...

Again, I very much appreciate your patience during this process.

@Kosta404
Copy link
Author

Kosta404 commented Aug 3, 2020

@MartyG-RealSense I copied and executed the command including specifying version with that part of command, during installation.

@Kosta404
Copy link
Author

Kosta404 commented Aug 3, 2020

@MartyG-RealSense Maybe the problem is in SDK version. The version I had working before is 2.35, but now the version installed is 2.36. Can you please give me an advise how can I install 2.35?

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Aug 3, 2020

If you are building librealsense from a source code folder as the Pi installation instruction page suggests, you can get the source code folder for any SDK version from the "Assets" list at the bottom of each version's information on the SDK Releases page:

2.35.0

https://github.com/IntelRealSense/librealsense/releases/tag/v2.35.0

2.35.2

https://github.com/IntelRealSense/librealsense/releases/tag/v2.35.2

Download the source code zip file and extract the librealsense folder from it, and then do the usual process of mkdir build and cd build, and using the CMake statement.

image

@Kosta404
Copy link
Author

Kosta404 commented Aug 3, 2020

If you are building librealsense from a source code folder as the Pi installation instruction page suggests, you can get the source code folder for any SDK version from the "Assets" list at the bottom of each version's information on the SDK Releases page:

2.35.0

https://github.com/IntelRealSense/librealsense/releases/tag/v2.35.0

2.35.2

https://github.com/IntelRealSense/librealsense/releases/tag/v2.35.2

Download the source code zip file and extract the librealsense folder from it, and then do the usual process of mkdir build and cd build, and using the CMake statement.

image

Ok, Thank you for assistance. I`ll try and reply tomorrow.

@MartyG-RealSense
Copy link
Collaborator

Thanks again!

@MartyG-RealSense
Copy link
Collaborator

Hi again @Kosta404 A pyrealsense2 user on the Intel Support version of the RealSense forum who was also using the acrobotic guide had the Module 'pyrealsense2' has no attribute 'pipeline' error too and posted the solution that worked for them.

https://support.intelrealsense.com/hc/en-us/community/posts/360048396854/comments/360012486393

@Kosta404
Copy link
Author

Kosta404 commented Aug 4, 2020

@MartyG-RealSense Hello! I installed librealsense v2.35.2 and all started working. I guess there is some problem with the latest version of librealsense v2.36.0. Thank you for the provided assistance!

@Kosta404 Kosta404 closed this as completed Aug 4, 2020
@MartyG-RealSense
Copy link
Collaborator

Thanks very much for letting us know about your success - great to hear!

@MartyG-RealSense
Copy link
Collaborator

Hi @pilipili-vr Installing the pyrealsense2 wrapper on Pi tends to be unpredictably problematic. It either goes fine first time or you encounter problems. It sounds as though you are using the acrobotic guide in the link below. Is that correct,please?

https://github.com/acrobotic/Ai_Demos_RPi/wiki/Raspberry-Pi-4-and-Intel-RealSense-D435

My recollection of the module 'pyrealsense2 has no attribute 'pipeline' error is that it is related to script programming rather than an installation error (where you might instead encounter an error such as no module named pyrealsense2).

Does that resemble your situation, please - that you only get the error when running a pyrealsense2 script?

If so, did you set up the pipeline in your pyrealsense2 script in that way that the example program on the front page of the wrapper documentation suggests:

https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python#streaming-using-rspipeline

import pyrealsense2:

import pyrealsense2 as rs

And then define 'pipeline':

pipeline = rs.pipeline()

Because pipeline is made equal to RS.pipeline, it depends on 'rs' being set up in the first line by '*import pyrealsense2 as rs'

@Solidifyconceptdevelopment

It works when running in terminal. I was using Thonny and that's where I got the error, but running it in terminal everything seems just fine. That's why I removed my comment, but thanks anyway. I did indeed follow the Acrobotic guide.

@MartyG-RealSense
Copy link
Collaborator

Great news that it is working in the terminal for you - thanks very much for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants