Can't import yython arcade

Problem description:
Cannot import the “arcade” python library

Expected behavior:
I should be able to import the “arcade” python library without errors

Actual behavior:
Importing arcade produces the following errors:

Traceback (most recent call last):
  File "/home/runner/arcadetest/venv/lib/python3.8/site-packages/pyglet/__init__.py", line 335, in __getattr__
    return getattr(self._module, name)
AttributeError: 'NoneType' object has no attribute 'Label'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 1, in <module>
    import arcade
  File "/home/runner/arcadetest/venv/lib/python3.8/site-packages/arcade/__init__.py", line 335, in <module>
    from .text_pyglet import (
  File "/home/runner/arcadetest/venv/lib/python3.8/site-packages/arcade/text_pyglet.py", line 83, in <module>
    def _draw_label_with_rotation(label: pyglet.text.Label, rotation: float) -> None:
  File "/home/runner/arcadetest/venv/lib/python3.8/site-packages/pyglet/__init__.py", line 341, in __getattr__
    __import__(import_name)
  File "/home/runner/arcadetest/venv/lib/python3.8/site-packages/pyglet/text/__init__.py", line 81, in <module>
    from pyglet.text import layout, document, caret
  File "/home/runner/arcadetest/venv/lib/python3.8/site-packages/pyglet/text/layout.py", line 166, in <module>
    from pyglet.font.base import grapheme_break
  File "/home/runner/arcadetest/venv/lib/python3.8/site-packages/pyglet/font/__init__.py", line 77, in <module>
    from pyglet.font.freetype import FreeTypeFont
  File "/home/runner/arcadetest/venv/lib/python3.8/site-packages/pyglet/font/freetype.py", line 44, in <module>
    from pyglet.font.freetype_lib import *
  File "/home/runner/arcadetest/venv/lib/python3.8/site-packages/pyglet/font/freetype_lib.py", line 40, in <module>
    _libfreetype = pyglet.lib.load_library('freetype')
  File "/home/runner/arcadetest/venv/lib/python3.8/site-packages/pyglet/lib.py", line 168, in load_library
    raise ImportError('Library "%s" not found.' % names[0])
ImportError: Library "freetype" not found.

Steps to reproduce:

  1. Add the arcade library to the project using the package manager.
  2. Create a python script with one line: import arcade
  3. Run

Bug appears at this link:

https://replit.com/@mrevansinfo/arcadetest?v=1

Browser/OS/Device:

Firefox & Chrome / Windows & Linux / PC

I found a working template in which someone was able to use the arcade python library. Give it a try and let me know if it worked.

https://replit.com/@StephenFranz1/WealthyAnxiousProcedures

I tried it and it didn’t work. Here’s the console output:

SoLoud dynamic link library /home/runner/LzpiO-Hkp-l/arcade/soloud/libsoloud.so not found. libasound.so.2: cannot open shared object file: No such file or directory
Warning, can’t initialize soloud name ‘soloud_dll’ is not defined. Sound support will be limited.
Traceback (most recent call last):
File “/home/runner/LzpiO-Hkp-l/main.py”, line 2, in
import arcade
File “/home/runner/LzpiO-Hkp-l/arcade/init.py”, line 226, in
from .tilemap import get_tilemap_layer
File “/home/runner/LzpiO-Hkp-l/arcade/tilemap.py”, line 34, in
def read_tmx(tmx_file: str) → pytiled_parser.objects.TileMap:
AttributeError: module ‘pytiled_parser’ has no attribute ‘objects’
exit status 1

Did you just run the repl or did you fork it and try to run it with your code?

they ran the repl. I checked

see if running this in shell (on your original repl) helps:

sed -i "s/];/  pkgs.freetype  \n&/" replit.nix
1 Like