Comments (18)
thanks bro, you are very helpful
from rf24.
I need a little more information to help you.
- How exactly did you install the python module?
- Are you using
sudo
?
from rf24.
I used virtual environment because raspberry refused to install RF24 and many other modules like numpy
from rf24.
You still haven't answered my questions.
Are you following our documented instructions about installing the python wrapper?
from rf24.
your document talk about Linux not raspbian
from rf24.
also i tried more than method to install your module, but every time after i finished this message appeared to me: "unable to locate xyz"
xyz is the module or in the best case it's the RF24 method inside RF24 module
from rf24.
I can't help you if you don't tell me the exact commands that you are typing.
Raspbian (which has been renamed to "RPi OS") is a flavor of Linux. The install instructions are the same for any flavor of Linux (even Ubuntu).
It would be better if you posted the exact error message instead of telling me what you think the error message means. I doubt that it has trouble locating the RF24 class (not a method) if it can locate the RF24 module. Usually, this is because
- you used
sudo
to install the module but not to execute the example - you used
sudo
to execute the example but not to install the module
Do not use sudo
!
This is talked about in the note at the end of the install instructions, especially regarding the use of a virtual environment (or also known as "venv"). We recommend that users install the C++ RF24 library using the SPIDEV driver because (among other good reasons) it doesn't require sudo
to execute. The driver named RPi will be removed in the future because it is not compatible with RPi5 or newer.
I'm also sensing that English is not your primary language. You can write here in your preferred language, and I'll just use Google translate on my end. Hopefully that helps.
from rf24.
this is the last step i reached
>>> import RF24
>>> from RF24 import RF24
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'RF24' from 'RF24' (unknown location)
you can see that i can import RF24 without any problems, but once i tried to import RF24 method from RF24 module, it can't be done
dear, you are right, English is not my native language, but if i used google translate it will be more difficult that's because google translate, translate literal translation
from rf24.
By following both the
- instructions to build and install the C++ RF24 library.
- instructions to build and install the python wrapper
I'm still not able to reproduce this error message.
I REALLY NEED TO KNOW THE COMMANDS YOU USE TO INSTALL THE RF24 MODULE!
from rf24.
sudo apt update
sudo apt upgrade -y
sudo apt install -y build-essential cmake python3-dev python3-pip python3-venv git
cd ~
python3 -m venv rf24_env
source rf24_env/bin/activate
git clone https://github.com/nRF24/RF24.git
cd ~/RF24
mkdir build
cd build
cmake ..
make
sudo make install
cd ~/RF24/pyRF24
python3 setup.py build
python3 setup.py install
from rf24.
before installing updates
It is important to delete old build artifacts and uninstall any previous pyRF24 module.
cd ~/RF24
sudo rm -r build/
rm Makefile.inc
cd pyRF24
rm -r build/ __pycache__/ RF24.egg-info/
cd ../
sudo rm /usr/local/lib/librf24.*
python3 -m pip uninstall RF24
Then repeat all the commands you posted.
Tip
Please explicitly use the SPIDEV driver. This command:
cmake ..
should be replaced with
cmake .. -DRF24_DRIVER=SPIDEV
Important
The following commands are no longer encouraged. These commands:
python3 setup.py build
python3 setup.py install
should be replaced with
python3 -m pip install .
So, the build commands (as simplified from linked instructions) is:
cd ~/RF24
sudo rm -r build/
rm Makefile.inc
cd pyRF24
rm -r build/ __pycache__/ RF24.egg-info/
cd ../
sudo rm /usr/local/lib/librf24.*
python3 -m pip uninstall RF24
mkdir build && cd build
cmake .. -DRF24_DRIVER=SPIDEV
make
sudo make install
cd ../pyRF24
python3 -m pip install .
from rf24.
If you are seeing a build error, then you should also report that here.
The following is an error:
pyRF24.cpp:1:10: fatal error: boost/python.hpp: No such file or directory
1 | #include <boost/python.hpp>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
This means you need to install boost.python library first:
sudo apt install libboost-python-dev
sudo ln -s $(ls /usr/lib/$(ls /usr/lib/gcc | tail -1)/libboost_python3*.so | tail -1) /usr/lib/$(ls /usr/lib/gcc | tail -1)/libboost_python3.so
Then try
python3 -m pip install --force-reinstall .
from rf24.
last update dear
sudo apt install libboost-python-dev
sudo ln -s $(ls /usr/lib/$(ls /usr/lib/gcc | tail -1)/libboost_python3*.so | tail -1) /usr/lib/$(ls /usr/lib/gcc | tail -1)/libboost_python3.so
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libboost-python-dev is already the newest version (1.74.0.3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
ln: failed to create symbolic link '/usr/lib/aarch64-linux-gnu/libboost_python3.so':
File exists
from rf24.
Ok, the "File exists" output is good. It means that pyRF24/setup.py can build as expected.
Has any of this helped?
Are you still getting the ImportError
?
I am also curious, what is your output for the following command?
pip list
from rf24.
moshtohor@raspberrypi:~ $ pip list
Package Version
---------------------------------- ----------
arandr 0.1.11
asgiref 3.6.0
astroid 2.14.2
asttokens 2.2.1
av 10.0.0
Babel 2.10.3
beautifulsoup4 4.11.2
blinker 1.5
certifi 2022.9.24
chardet 5.1.0
charset-normalizer 3.0.1
click 8.1.3
colorama 0.4.6
colorzero 2.0
cryptography 38.0.4
cupshelpers 1.0
dbus-python 1.3.2
dill 0.3.6
distlib 0.3.6
distro 1.8.0
docutils 0.19
filelock 3.9.0
Flask 2.2.2
gpiozero 2.0
html5lib 1.1
idna 3.3
importlib-metadata 4.12.0
isort 5.6.4
itsdangerous 2.1.2
jedi 0.18.2
Jinja2 3.1.2
lazy-object-proxy 1.9.0
lgpio 0.2.2.0
libevdev 0.5
logilab-common 1.9.8
lxml 4.9.2
MarkupSafe 2.1.2
mccabe 0.7.0
meson 1.0.1
more-itertools 8.10.0
mypy 1.0.1
mypy-extensions 0.4.3
numpy 1.24.2
oauthlib 3.2.2
olefile 0.46
parso 0.8.3
pexpect 4.8.0
pgzero 1.2
picamera2 0.3.18
pidng 4.0.9
piexif 1.1.3
pigpio 1.78
Pillow 9.4.0
pip 23.0.1
platformdirs 2.6.0
psutil 5.9.4
ptyprocess 0.7.0
pycairo 1.20.1
pycryptodomex 3.11.0
pycups 2.0.1
pygame 2.1.2
Pygments 2.14.0
PyGObject 3.42.2
pyinotify 0.9.6
PyJWT 2.6.0
pylint 2.16.2
PyOpenGL 3.1.6
pyOpenSSL 23.0.0
PyQt5 5.15.9
PyQt5-sip 12.11.1
pyserial 3.5
pysmbc 1.0.23
python-apt 2.6.0
python-dotenv 0.21.0
python-prctl 1.8.1
pytz 2022.7.1
pyudev 0.24.0
reportlab 3.6.12
requests 2.28.1
requests-oauthlib 1.3.0
responses 0.18.0
roman 3.3
RPi.GPIO 0.7.1a4
RTIMULib 7.2.1
Send2Trash 1.8.1b0
sense-hat 2.6.0
setuptools 66.1.1
simplejpeg 1.6.6
simplejson 3.18.3
six 1.16.0
smbus2 0.4.2
soupsieve 2.3.2
spidev 3.5
ssh-import-id 5.10
thonny 4.1.4
toml 0.10.2
tomlkit 0.11.7
twython 3.8.2
types-aiofiles 22.1
types-annoy 1.17
types-appdirs 1.4
types-aws-xray-sdk 2.10
types-babel 2.11
types-backports.ssl-match-hostname 3.7
types-beautifulsoup4 4.11
types-bleach 5.0
types-boto 2.49
types-braintree 4.17
types-cachetools 5.2
types-caldav 0.10
types-certifi 2021.10.8
types-cffi 1.15
types-chardet 5.0
types-chevron 0.14
types-click-spinner 0.1
types-colorama 0.4
types-commonmark 0.9
types-console-menu 0.7
types-contextvars 2.4
types-croniter 1.3
types-cryptography 3.3
types-D3DShot 0.1
types-dateparser 1.1
types-DateTimeRange 1.2
types-decorator 5.1
types-Deprecated 1.2
types-dj-database-url 1.0
types-docopt 0.6
types-docutils 0.19
types-editdistance 0.6
types-emoji 2.1
types-entrypoints 0.4
types-first 2.0
types-flake8-2020 1.7
types-flake8-bugbear 22.10.27
types-flake8-builtins 2.0
types-flake8-docstrings 1.6
types-flake8-plugin-utils 1.3
types-flake8-rst-docstrings 0.2
types-flake8-simplify 0.19
types-flake8-typing-imports 1.14
types-Flask-Cors 3.0
types-Flask-SQLAlchemy 2.5
types-fpdf2 2.5
types-gdb 12.1
types-google-cloud-ndb 1.11
types-hdbcli 2.14
types-html5lib 1.1
types-httplib2 0.21
types-humanfriendly 10.0
types-invoke 1.7
types-JACK-Client 0.5
types-jmespath 1.0
types-jsonschema 4.17
types-keyboard 0.13
types-ldap3 2.9
types-Markdown 3.4
types-mock 4.0
types-mypy-extensions 0.4
types-mysqlclient 2.1
types-oauthlib 3.2
types-openpyxl 3.0
types-opentracing 2.4
types-paho-mqtt 1.6
types-paramiko 2.11
types-parsimonious 0.10
types-passlib 1.7
types-passpy 1.0
types-peewee 3.15
types-pep8-naming 0.13
types-Pillow 9.3
types-playsound 1.3
types-polib 1.1
types-prettytable 3.4
types-protobuf 3.20
types-psutil 5.9
types-psycopg2 2.9
types-pyaudio 0.2
types-PyAutoGUI 0.9
types-pycurl 7.45
types-pyfarmhash 0.3
types-pyflakes 2.5
types-Pygments 2.13
types-pyinstaller 5.6
types-PyMySQL 1.0
types-pynput 1.7
types-pyOpenSSL 22.1
types-pyRFC3339 1.1
types-PyScreeze 0.1
types-pysftp 0.2
types-pytest-lazy-fixture 0.6
types-python-crontab 2.6
types-python-dateutil 2.8
types-python-gflags 3.1
types-python-jose 3.3
types-python-nmap 0.7
types-python-slugify 6.1
types-pytz 2022.6
types-pyvmomi 7.0
types-pywin32 304
types-PyYAML 6.0
types-redis 4.3
types-regex 2022.10.31
types-requests 2.28
types-retry 0.9
types-Send2Trash 1.8
types-setuptools 65.5
types-simplejson 3.17
types-singledispatch 3.7
types-six 1.16
types-slumber 0.7
types-SQLAlchemy 1.4.43
types-stdlib-list 0.8
types-stripe 3.5
types-tabulate 0.9
types-termcolor 1.1
types-toml 0.10
types-toposort 1.7
types-tqdm 4.64
types-tree-sitter 0.20
types-tree-sitter-languages 1.5
types-ttkthemes 3.2
types-typed-ast 1.5
types-tzlocal 4.2
types-ujson 5.5
types-urllib3 1.26
types-vobject 0.9
types-waitress 2.1
types-whatthepatch 1.0
types-xmltodict 0.13
types-xxhash 3.0
types-zxcvbn 4.4
typing_extensions 4.4.0
urllib3 1.26.12
v4l2-python3 0.3.3
virtualenv 20.17.1+ds
webencodings 0.5.1
Werkzeug 2.2.2
wheel 0.38.4
wrapt 1.14.1
zipp 1.0.0
moshtohor@raspberrypi:~ $ python3
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import RF24
>>> from RF24 import RF24
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'RF24' from 'RF24' (unknown location)
>>>
from rf24.
I don't see RF24 in the pip list
output. This means that it is not installed. There must be some build error that you are not aware of (or not telling me about).
This spoken language barrier between us makes helping you too difficult for me.
I only have 1 last recommendation: Switch to using our newer pyrf24 package. You only need to change the import statements.
python3 -m pip install pyrf24
>>> from pyrf24 import RF24
>>> radio = RF24(22, 0)
>>> radio.begin()
True
from rf24.
I'm sensing that you don't know how to use a python virtual environment. It is not my job to teach people how to use python. You'll need to learn this from somewhere else.
from rf24.
Now that I have nothing left to recommend or suggest, I'm going to close this. You can still post comments here if you want.
from rf24.
Related Issues (20)
- Is there a known ESP32 Deep Sleep issue with radio.powerDown()? [Question] HOT 19
- Can RF24 library be used with WiFi? HOT 2
- Can RF24 library be used with WiFi? HOT 4
- [Question] setChannel & setDataRate not read correctly by printPrettyDetails ? HOT 4
- ESP32 Core Panic on radio 0; No panic on Radio number 1, same wiring. How to troubleshoot?[Question] HOT 22
- Use Linux kernel's character device API to implement IRQ capability HOT 113
- [Question] R24.h, testRPD(void) "Strong signal > 64dBm" : "Weak signal < 64dBm" HOT 5
- [Question] Issue using the ManualAcknowledgements.ino HOT 11
- Multiple senders one receiver HOT 1
- reorganize examples HOT 5
- revise MRAA driver's GPIO
- Phasing out most Linux drivers HOT 1
- [Question] Address names used in examples problematic? HOT 8
- Library blocks 11 pin HOT 1
- Unable to use SPI1 on the raspberry pi pico HOT 3
- NRF24L01 does not show all characters in the receiver HOT 4
- Problem using stopListening() and startListening() HOT 3
- [Question] Some modules take way longer to write() HOT 6
- Change `SERIAL_DEBUG` into `RF24_DEBUG` HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rf24.