0

i am making a hard version of atari breakout

so when i import pymunk because I wanted to make the ball then it will say "no module named "_cffi_backend"

i have asked people on Youtube and reddit but nobody answered the questions

i have tried uninstalling cffi and pymunk, downgrading python and more

can anybody fix this problem (and also i use microsoft visual studio 2019 and pyglet and python 3.9)

https://i.stack.imgur.com/sBY1O.png

1 Answers1

0

Can it be because of something fishy with Visual Studio? Otherwise I cant think of much..

To validate if Pymunk can work on your computer you can try to install a fresh Python and Pymunk through conda, which will give you a completely separate installation of Python.

  1. Download and install Miniforge: https://github.com/conda-forge/miniforge (If you get the option, dont set this new miniforge Python as your default Python)
  2. Open the miniforge command line prompt and run conda install pymunk
  3. When installed, run python -m pymunk.tests
  4. Add the output here :)

Secondly, you can try to run your project from the command line instead of from within VS.

  1. First you need to find out the folder where you have the files. In VS you can right-click on the file and use "Open Containing Folder" to go to the file in Explorer. You can also use "Copy full path" to copy the path.
  2. Next, open the command prompt (or Windows Terminal in case you have it installed).
  3. Navigate to the folder with the file. cd long-path-to-folder
  4. Run the "main" file, I guess its atari.py in your case, but Im not really sure.
viblo
  • 4,159
  • 4
  • 20
  • 28
  • i couldn't setup mini forge but without miniforge (i downloaded the github from your link) but when i use normal python with the command it said "OK (1 skipped)" – dragonitebrian1024 Mar 28 '22 at 20:10
  • Ok. If python -m pymunk.tests works without issues it means that you can use Pymunk on your computer, but for some reason it doesnt work from within Visual Studio. Can you try to run your whole project from the command line instead of from within Visual Studio? That would be a final test to verify that it is indeed VS that creates the problem – viblo Mar 29 '22 at 07:10
  • first of all how do i navigate to the file and second i ran it in python idle 3.9 and it also didn't work – dragonitebrian1024 Mar 29 '22 at 20:43
  • Oi, I expanded my answer with a bit more info about this – viblo Mar 30 '22 at 11:39
  • for some reason when i run it on cmd it says i haven't got the ball.png when i have put it in the directory file – dragonitebrian1024 Mar 30 '22 at 16:31
  • My guess based on the screenshot: Make sure all the images are in the same place, and then load all 3 of them with pyglet.resource.image, like you do with the first block.png file. – viblo Mar 30 '22 at 19:09
  • i did it and it still said the error – dragonitebrian1024 Apr 08 '22 at 20:01
  • Im pretty sure now that there is a problem with how python is setup on your computer. Unfortunately I think it is too difficult and inconvenient to handle it here on SO. Instead I think your best bet is to go to the python discord to get "live" help from someone: https://discord.com/invite/python – viblo Apr 12 '22 at 14:32