Can't add pypiano to my replit

How do I properly install packages into the shell :

Repl link/Link to where the bug appears:
Music of python - Replit
Screenshots, links, or other helpful context:


pip install git+https://github.com/FelixGSE/pypiano.git
from pypiano import Piano
from mingus.containers import Note

p = Piano()

# Play a simple C-4 via audio
p.play("C-4")

# Play a mingus Note
note = Note("C-4")
p.play(note)

# Record a Note to a wav file
p.play(note, recording_file="my_first_recording.wav", record_seconds=2)

# Use a different instrument
p.load_instrument("Honky-tonk Piano")
p.play(note)

Worked fine for my case
Just paste this in terminal not in code

pip install git+https://github.com/FelixGSE/pypiano.git
1 Like

@prakhardoneria But that’s exactly what OP did. See the screenshot. It returned an error.
@Kingdogg try running poetry add pypiano in the Shell.
Hope this helps!

1 Like


It didn’t work for me for some reason.

It failed to build numpy

try again after running in Shell:

nix-editor -hapkgs.gcc

(ar executable is provided by gcc apparently)

1 Like


It appears that have not worked. I will send a link to this repl.
main.py - Pypaino replit - Replit

It appears that pip and pip-install are installed in your repl when they should not be.
Open the Shell and remove them:

poetry remove pip, pip-install

Then, try installing pypiano using the Packages tool.

2 Likes

I have already tried doing that in another replit

try after running rm -r $PYTHONUSERBASE to clean up the mess. But I see that cleaning up pip doesn’t fix the issue either. I suspect that pypiano has an unnecessarily strict requirement for an old version of numpy which needs extra compilation steps.


when you paste this in Shell (including the newline at the end):

nix-editor -hapkgs.gcc

it should have added a hidden replit.nix file and looked like
image

You could also add gcc in the system dependencies tool.

1 Like

So something like this.

I think that your right, pypiano most likely requires a strict version of numpy.

You can see what I’ve tried so far here, but you get ALSA errors. It seems the only way to play sounds is with GUI libraries like pygame or by using replit.audio.

2 Likes

All righty, I will try to use the pygame library to make sounds, thank you everyone for trying to help.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.