"No module named phoenix5" when we have it installed?

We installed robotpy and all the rev/ctre libraries we need on both our driver station laptop and roboRIO. The code successfully deploys to the robot, but we get an error message in the console saying the following:

 ERROR: importing /home/lvuser/py/robot.py failed! 
 Traceback (most recent call last): 
   File "/usr/local/lib/python3.12/site-packages/robotpy/main.py", line 68, in _load_robot_class 
     spec.loader.exec_module(module) 
   File "<frozen importlib._bootstrap_external>", line 994, in exec_module 
   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed 
   File "/home/lvuser/py/robot.py", line 3, in <module> 
     import phoenix5 
 ModuleNotFoundError: No module named 'phoenix5' 

I know we have phoenix5 installed, so I am not sure why it does not seem to be working on the robot. I believe it may be a problem with robotpy sync or deploy, but we have phoenix5 and all the requirements we need in the “pyproject.toml” file. Does anyone encountered the same problem or know how to resolve it?

Make sure you do pip install -U robotpy-installer since I’ve made some updates that improve some of the deploy functionality, and then do a sync/deploy again.

We ran this command and still have the same issue. How are we supposed to be running the sync and deploy commands?

This is my pyproject.toml file:

#
# Use this configuration file to control what RobotPy packages are installed
# on your RoboRIO
#

[tool.robotpy]

# Version of robotpy this project depends on
robotpy_version = "2024.1.1.3"

# Which extra RobotPy components should be installed
# -> equivalent to `pip install robotpy[extra1, ...]
robotpy_extras = ["phoenix5"]

# Other pip packages to install
requires = [
    "robotpy-commands-v2==2024.0.0b4"

]

When I run the sync command connected to Wi-Fi it says “requirement already satisfied” and “file already downloaded”. When I run it connected to the robot’s LAN, it says:

Sync connected to robot's LAN error message
09:53:49:349 INFO    : robotpy.installer   : RobotPy Installer 2024.0.5
09:53:49:350 INFO    : robotpy.installer   : -> caching files at C:\Users\team2984\wpilib\2024\robotpy
09:53:49:354 INFO    : sync                : Robot project requirements:
09:53:49:355 INFO    : sync                : - robotpy[phoenix5]==2024.1.1.3
09:53:49:355 INFO    : sync                : - robotpy-commands-v2==2024.0.0b4
09:53:49:355 INFO    : sync                : Downloading Python for RoboRIO
Downloading https://github.com/robotpy/roborio-python/releases/download/2024-3.12.1-r1/python312_3.12.1-r1_cortexa9-vfpv3.ipk
Traceback (most recent call last):
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 1344, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1327, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1373, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1322, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1081, in _send_output
    self.send(msg)
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1025, in send
    self.connect()
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1461, in connect
    super().connect()
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 991, in connect
    self.sock = self._create_connection(
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\socket.py", line 828, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\socket.py", line 963, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotpy\__main__.py", line 4, in <module>
    main()
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotpy\main.py", line 314, in main
    retval = subcommand.run(**kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotpy_installer\utils.py", line 170, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotpy_installer\cli_sync.py", line 123, in run
    installer.download_python(use_certifi)
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotpy_installer\installer.py", line 394, in download_python    
    _urlretrieve(_PYTHON_IPK, ipk_dst, True, _make_ssl_context(use_certifi))
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotpy_installer\utils.py", line 119, in _urlretrieve
    raise e
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotpy_installer\utils.py", line 72, in _urlretrieve
    urllib.request.urlopen(req, context=ssl_context)
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 215, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 515, in open
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 532, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 1392, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\team2984\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 1347, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 11001] getaddrinfo failed>

When I run the deploy command connected to the robot’s LAN, I get the following message. It seems to deploy correctly.

Deploy connected to LAN message
[phoenix] CANbus Connected: sim
[phoenix] CANbus Network Up: sim
09:54:51:331 INFO    : deploy              : Running tests: C:\Users\team2984\AppData\Local\Programs\Python\Python312\python.exe -m robotpy --main C:\Users\team2984\Desktop\2024\Crescendo2024\robot.py test
[phoenix] CANbus Connected: sim
[phoenix] CANbus Network Up: sim
09:54:52:968 WARNING : pyfrc.physics       : Cannot enable physics support, C:\Users\team2984\Desktop\2024\Crescendo2024\physics.py not found
=============================================================== test session starts ================================================================
platform win32 -- Python 3.12.1, pytest-7.4.4, pluggy-1.3.0
rootdir: C:\Users\team2984\Desktop\2024\Crescendo2024\tests
plugins: reraise-2.1.2
collected 4 items

pyfrc_test.py ...[phoenix] Library initialization is complete.

.                                                                                                                            [100%]

================================================================ 4 passed in 1.48s ================================================================= 

********** Robot program startup complete **********
[phoenix-diagnostics] Server shutdown cleanly. (dur:0)

[phoenix] Library shutdown cleanly

09:54:54:884 INFO    : deploy              : Robot project requirements:
09:54:54:885 INFO    : deploy              : - robotpy[phoenix5]==2024.1.1.3
09:54:54:887 INFO    : deploy              : - robotpy-commands-v2==2024.0.0b4
09:54:54:983 INFO    : robotpy.installer   : Settings loaded from C:\Users\team2984\Desktop\2024\Crescendo2024\.wpilib\wpilib_preferences.json
09:54:54:983 INFO    : robotpy.installer   : Finding robot for team 2984
09:54:54:993 INFO    : robotpy.installer   : -> Robot is at 10.29.84.2
09:54:54:994 INFO    : robotpy.installer   : Connecting to robot via SSH at 10.29.84.2
09:54:55:143 INFO    : paramiko.transport  : Connected (version 2.0, client OpenSSH_8.3)
09:54:55:305 INFO    : paramiko.transport  : Auth banner: b'NI Linux Real-Time (run mode)\n\nLog in with your NI-Auth credentials.\n\n'
09:54:55:307 INFO    : paramiko.transport  : Authentication (password) successful!
09:54:55:309 INFO    : robotpy.installer   : Clearing FRC C++/Java user programs if present
[phoenix-diagnostics] Server 2024.1.0 (Jan  8 2024, 18:17:47) running on port: 1250

09:54:56:982 INFO    : deploy              : All project requirements already installed
09:54:57:509 INFO    : paramiko.transport.sftp: [chan 6] Opened sftp connection (server version 3)
make /home/lvuser/py_new
deploy.json -> /home/lvuser/py_new/deploy.json
pyproject.toml -> /home/lvuser/py_new/pyproject.toml
robot.py -> /home/lvuser/py_new/robot.py
make /home/lvuser/py_new/commands
make /home/lvuser/py_new/subsystems
subsystems\drive.py -> /home/lvuser/py_new/subsystems/drive.py
make /home/lvuser/py_new/tests
tests\pyfrc_test.py -> /home/lvuser/py_new/tests/pyfrc_test.py
make /home/lvuser/py_new/tests/ctre_sim
make /home/lvuser/py_new/utils
utils\constants.py -> /home/lvuser/py_new/utils/constants.py
make /home/lvuser/py_new/vendordeps
vendordeps\WPILibNewCommands.json -> /home/lvuser/py_new/vendordeps/WPILibNewCommands.json
09:54:57:844 INFO    : paramiko.transport.sftp: [chan 6] sftp session closed.
Sat Jan 20 09:54:58 PST 2024 - Killing robot code in frcKillRobot.sh

SUCCESS: Deploy was successful!
[phoenix-diagnostics] Server shutdown cleanly. (dur:0)

[phoenix] Library shutdown cleanly

I am guessing it is because I am connected to the robot in the wrong way when running these commands or something is wrong with my pyproject.toml file.

It shows that you have robotpy-installer 2024.0.5, the latest is 2024.1.1 (and the bugs were fixed in 2024.1.0). It’s weird that pip install -U robotpy-installer didn’t work … so you can do pip install robotpy-installer==2024.1.1 to ensure that you get the latest version.

Run the sync when connected to wifi.

Run the deploy when connected to the robot.

When we roll the next release of robotpy this weekend we’ll definitely make sure to bump the installer requirement.

This worked, thanks.