Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows install(really rookie) #338

Closed
KnightOf opened this issue Jul 30, 2018 · 16 comments
Closed

windows install(really rookie) #338

KnightOf opened this issue Jul 30, 2018 · 16 comments

Comments

@KnightOf
Copy link

KnightOf commented Jul 30, 2018

hi im try to use vizdoom on my computer
os:windows10
i've install vizdoom in D:\Users\user\Anaconda3\Lib\site-packages\vizdoom
and my basic.py is in D:\Users\user\Anaconda3\Lib\site-packages\vizdoom\examples
use vscode to run this

from vizdoom import *
import random, time

game = DoomGame()
game.load_config("../config/basic.cfg")
game.init()

shoot = [0,0,1]
left = [1,0,0]
right = [0,1,0]

episodes = 10
for i in range(episodes):
game.new_episode()
while not game.is_episode_finished():
state = game.get_state()
img = state.image_buffer
misc = state.game_variables
action = random.choice([shoot, left, right]) # A random agent
reward = game.make_action(action)
time.sleep(0.02) # Just to make it slower
print("Total reward: " + str(game.get_total_reward()))

and got this
D:#Git\Python>python vizdoom.py
Traceback (most recent call last):
File "vizdoom.py", line 1, in
from vizdoom import *
File "D:#Git\Python\vizdoom.py", line 4, in
game = DoomGame()
NameError: name 'DoomGame' is not defined

im not sure what kind of problem am i running to

since i dont really understand the installing step
so any problem is possible to make by me,
im very sorry for such unclear question,and ive been searching for solution for a long time
and i still cant figure it out.
if i miss any information for my question,please let me know.
thank you for your apply.

oh ! i can run vizdoom.exe,dont know would that help?

@Miffyli
Copy link
Collaborator

Miffyli commented Jul 30, 2018

Did you download the built release and copied the files to right place ? ViZDoom requires some binaries to function, and building them on Windows is tedious, hence it is easier to use pre-built binaries on the releases page.

@KnightOf
Copy link
Author

HI Miffyli
thank u for ur response
image
here's what ive got in site-packages
btw im using vscode,and my python.exe is in
D:\Users\user\Anaconda3\Lib\site-packages\vizdoom\examples>where python
D:\Users\user\Anaconda3\python.exe
if i've got misundetstanding anything,pls let me know.
im not sure am i doing right about this.

@Miffyli
Copy link
Collaborator

Miffyli commented Jul 30, 2018

You need to place the binary files under site-packages, not site-packages/vizdoom. This seems rather dirty, but it is the way this works (you could also try importing from vizdoom.vizdoom import *, that could work as well)

@KnightOf
Copy link
Author

HI Miffyli
thank u for the response
i've tried ur solution such as changing from vizdoom import * -> from vizdoom.vizdoom import *
but it report this
ModuleNotFoundError: No module named 'vizdoom.vizdoom'; 'vizdoom' is not a package
im wondering if is could have another problem
cause in this folder i dont have file such as " bin/libvizdoom.a / vizdoom.lib"
(in this website's compilation output https://github.com/mwydmuch/ViZDoom/blob/master/doc/Building.md#windows_bin)
so is it posible that the problem is on "cmake"?

i'm extremely thankful for ur kind and time.

@Miffyli
Copy link
Collaborator

Miffyli commented Jul 30, 2018

In that case I think the only way is to copy binaries of ViZDoom in site-packages, i.e. you should have following:

D:\Users\user\Anaconda3\Lib\site-packages\vizdoom.exe
D:\Users\user\Anaconda3\Lib\site-packages\vizdoom.pyd
D:\Users\user\Anaconda3\Lib\site-packages\vizdoom.pk3
etc etc.

I have not installed ViZDoom under on Windows and under Anaconda, but judging by the instructions it is same as with non-conda install.

@KnightOf
Copy link
Author

hi Miffyli
i've follow ur clue to move every file in original
"D:\Users\user\Anaconda3\Lib\site-packages\vizdoom"
to
"D:\Users\user\Anaconda3\Lib\site-packages"
but i still got this error
NameError: name 'DoomGame' is not defined
so should i use cmake again for all the "XXXXX.so" file
and anything i would need to install .

thank u for ur time.

@Miffyli
Copy link
Collaborator

Miffyli commented Jul 30, 2018

Hmm interesting. Can you paste here what happens if you do this:

import vizdoom
print(dir(vizdoom))

@KnightOf
Copy link
Author

hi Miffyli
u mean like this?
image

@Miffyli
Copy link
Collaborator

Miffyli commented Jul 30, 2018

Ah yes. You have "vizdoom.py" file in your project folder, and importing "vizdoom" tries to import that Python file. Remove vizdoom.py file in your #Git\Python folder and try your codes again.

@KnightOf
Copy link
Author

i got this error
D:#Git\Python>python test.py
Traceback (most recent call last):
File "test.py", line 1, in
import vizdoom
ImportError: DLL load failed: 找不到指定的模組。(cant find)

thank u for ur response

@mwydmuch
Copy link
Collaborator

Hello @KnightOf,
the correct way of installing windows package is to put vizdoom directory into Anaconda3\Lib\site-packages, so as you did at the beginning. Also, please check if you've chosen the right version.

@KnightOf
Copy link
Author

hi @mwydmuch
so i should have a "vizdoom" folder in "Anaconda3\Lib\site-packages"
and haveing all files including"bin/libvizdoom.a / vizdoom.lib","vizdoom.exe"etc.right?
but as u see i have a lot of file is missing such as libvizdoom.a or libvizdoom.so
so im wondering if i didnt do something?
I'm using your ViZDoom-1.1.5pre-Win-Python35-x86_64
did i make any mistake further?

thank u ,sincerely.

@mwydmuch
Copy link
Collaborator

Everything that is required is already included in zip archive.
Files such as libvizdoom.a or libvizdoom.so are C++ dev libraries for Linux and MacOS.
That is why they are omitted in the prebuild archive.

Please check if your Anaconda 3 is 3.5 or 3.6 Python based.
This may be a reason behind "ImportError: DLL load failed: 找不到指定的模組" error.

@KnightOf
Copy link
Author

hello @mwydmuch
really thankful for your help
it seem like it worked rightnow
but when i run this
`from vizdoom import *
import random, time

game = DoomGame()
game.load_config("D:/Users/user/Anaconda3/envs/vizdoom/Lib/site-packages/vizdoom/scenarios/basic.cfg")
game.init()

shoot = [0,0,1]
left = [1,0,0]
right = [0,1,0]

episodes = 10
for i in range(episodes):
game.new_episode()
while not game.is_episode_finished():
state = game.get_state()
img = state.image_buffer
misc = state.game_variables
action = random.choice([shoot, left, right]) # A random agent
reward = game.make_action(action)
time.sleep(0.02) # Just to make it slower
print("Total reward: " + str(game.get_total_reward()))`

and it come out this

(vizdoom) D:#Git\Python>python test.py

OS: Windows NT (NT 10.0) Build 17134

D_DoomInit: Static RNGseed 2147483647 set.
M_LoadDefaults: Load system defaults.
Gameinfo scan took 20 ms
W_Init: Init WADfiles.
adding D:/Users/user/Anaconda3/envs/vizdoom/lib/site-packages/vizdoom/vizdoom.pk3, 583 lumps
adding D:/Users/user/Anaconda3/envs/vizdoom/lib/site-packages/vizdoom/freedoom2.wad, 3595 lumps
adding D:/Users/user/Anaconda3/envs/vizdoom/Lib/site-packages/vizdoom/scenarios/basic.wad, 7 lumps
viz_controlled is write protected.
viz_instance_id is write protected.
Traceback (most recent call last):
File "test.py", line 17, in
img = state.image_buffer
AttributeError: 'vizdoom.vizdoom.GameState' object has no attribute 'image_buffer'

what does it mean.
thank u for your time

@mwydmuch
Copy link
Collaborator

In current version, image_buffer attribute of GameState is named screen_buffer (from 1.1.0).

In case of some problem with attributes, see current version of basic.py example and Types.md.

@KnightOf
Copy link
Author

hi @mwydmuch @Miffyli
it runs succefully now
really appreciate to both of your help
thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants