Giter Club home page Giter Club logo

Comments (7)

DanielSlater avatar DanielSlater commented on June 29, 2024

Hi flobotics, your correct, the problem is that PyGame isn't installed. I had trouble installing pyGame into a vrtualenv, but here http://askubuntu.com/questions/299950/how-do-i-install-pygame-in-virtualenv is someone who succeeded. Personally I just installed it into root, the downloads for it are here: http://www.pygame.org/download.shtml

from pygameplayer.

flobotics avatar flobotics commented on June 29, 2024

thanks @DanielSlater for your answer, but i have installed pygame into root (with this i mean, simply installed with apt-get install python-pygame without being in virtualenv) but then i get this error? you have also installed it into root (or do you mean something else) but you dont have this "no module" error ? It seemed i need something else, or?

EDIT: i left the virtualenv with "deactivate", then i run "virtualenv --system-site-packages ../venv/" to use the python-pygame i installed with apt-get (i hope this command is doing this). Then i did

source bin/activate
(venv) ros@rospc1:~/Documents/python-virt-env/venv$ python examples/deep_q_pong_player.py 
Traceback (most recent call last):
  File "examples/deep_q_pong_player.py", line 5, in <module>
    from pong_player import PongPlayer
  File "/home/ros/Documents/python-virt-env/venv/examples/pong_player.py", line 2, in <module>
    from pygame_player import PyGamePlayer
ImportError: No module named pygame_player

Now it is missing also pygame_player, your code (its still in the virtualenv), but why ?

from pygameplayer.

flobotics avatar flobotics commented on June 29, 2024

i installed pygame directly into the virtual env (ubuntu 14.04) with

Then i simpy copy your code into the virtual env with e.g.

  • cp ~/git-repo/PyGamePlayer/* ~/python-virtual-env/venv

When i now want to run it with

  • python examples/deep_q_pong_player.py

i get:

 python examples/deep_q_pong_player.py 
Traceback (most recent call last):
  File "examples/deep_q_pong_player.py", line 240, in <module>
    player.start()
  File "/home/ros/Documents/python-virt-env/venv/examples/pong_player.py", line 32, in start
    import games.pong
ImportError: No module named games.pong
Exception AttributeError: AttributeError("'NoneType' object has no attribute 'raise_exception_on_not_ok_status'",) in <bound method Session.__del__ of <tensorflow.python.client.session.Session object at 0x7f23b1c12550>> ignored


what do i wrong?

from pygameplayer.

DanielSlater avatar DanielSlater commented on June 29, 2024

I'm surprised it would fail on import games.pong as that should just be in the PyGamePlayer project, it's not a PyGame dependency? Can you see it there in the folder?

from pygameplayer.

flobotics avatar flobotics commented on June 29, 2024

what file should i see ? here is the tree of the git-repo which i copy into the virtual-env with "cp -a".

Do you need another information ?

ros@rospc1:~/git-repos/PyGamePlayer$ tree .
.
├── examples
│   ├── deep_q_half_pong_networks_40x40_6
│   │   ├── checkpoint
│   │   ├── network-1190000
│   │   ├── network-1190000.meta
│   │   ├── network-1200000
│   │   ├── network-1200000.meta
│   │   ├── network-1210000
│   │   ├── network-1210000.meta
│   │   ├── network-1220000
│   │   ├── network-1220000.meta
│   │   ├── network-1230000
│   │   └── network-1230000.meta
│   ├── deep_q_half_pong_networks_40x40_8
│   │   ├── checkpoint
│   │   ├── network-1260000
│   │   ├── network-1260000.meta
│   │   ├── network-1270000
│   │   ├── network-1270000.meta
│   │   ├── network-1280000
│   │   ├── network-1280000.meta
│   │   ├── network-1290000
│   │   ├── network-1290000.meta
│   │   ├── network-1300000
│   │   └── network-1300000.meta
│   ├── deep_q_half_pong_player.py
│   ├── deep_q_pong_player.py
│   ├── __init__.py
│   ├── pong_player.py
│   ├── pong_player.pyc
│   └── tetris_player.py
├── games
│   ├── half_pong.py
│   ├── __init__.py
│   ├── mini_pong.py
│   ├── pong.py
│   └── tetris.py
├── __init__.py
├── LICENSE
├── pygame_player.py
├── README.md
└── tests
    ├── __init__.py
    └── test_pygame_player.py

5 directories, 39 files

from pygameplayer.

DanielSlater avatar DanielSlater commented on June 29, 2024

I would expect to see games.pong.py in there, and there it is. Which makes it surprising your getting the "ImportError: No module named games.pong" Exception...
You might find this resource helpful. Some people who are much better at setting up Python environments than me, helped put it together, it has more detailed instruction on running via docker or on mac https://github.com/DanielSlater/PyDataLondon2016/blob/master/README.md

from pygameplayer.

flobotics avatar flobotics commented on June 29, 2024

i use ubuntu 14.04, the repo of PyDataLondon2016 did not helped me much. But i got it to run, i think there is a better method, but it works. I simply copied the whole games/ directory into the virtual-envs lib/python2.7/site-packages/ directory, now i can execute "python examples/deep_q_pong_player.py" and it shows me a new window where pong is playing and on the console output is printed. thanks for this code to learn.

i use your code as start for my tests (https://github.com/flobotics/flobotics_tensorflow_controller/blob/master/nodes/listener.py) At the moment i am stuck with feeding the right shapes into the ops, perhaps you got some good ideas which helps me? If not, thanks for this code to learn

from pygameplayer.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.