chuyangliu / snake

Artificial intelligence for the Snake game.
Apache License 2.0
1.65k stars 481 forks source link

ImportError: DLL load failed: The specified procedure could not be found. #26

Closed luharinos closed 5 years ago

luharinos commented 6 years ago

I got the following error while I tried executing the repo:

Traceback (most recent call last):
  File "run.py", line 7, in <module>
    from snake.game import Game, GameConf, GameMode
  File "G:\AI IA 2\AiSnake\Snake\snake\game.py", line 12, in <module>
    from snake.solver import DQNSolver, GreedySolver, HamiltonSolver
  File "G:\AI IA 2\AiSnake\Snake\snake\solver\__init__.py", line 9, in <module>
    from snake.solver.dqn import DQNSolver
  File "G:\AI IA 2\AiSnake\Snake\snake\solver\dqn\__init__.py", line 11, in <module>
    import tensorflow as tf
  File "G:\AI IA 2\AiSnake\lib\site-packages\tensorflow\__init__.py", line 22, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "G:\AI IA 2\AiSnake\lib\site-packages\tensorflow\python\__init__.py", line 52, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "G:\AI IA 2\AiSnake\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
    from google.protobuf import descriptor as _descriptor
  File "G:\AI IA 2\AiSnake\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
    from google.protobuf.pyext import _message
ImportError: DLL load failed: The specified procedure could not be found.

Kindly help at the earliest possible.

chuyangliu commented 6 years ago

Have you run the following command?

$ pip3 install -r requirements.txt
luharinos commented 5 years ago

Yes, I created a python3.6 virtual environment, installed requirements.txt via pip, which showed an error:

tensorflow 1.11.0 has requirement setuptools<=39.1.0, but you'll have setuptools 40.4.3 which is
incompatible.

Later, I installed tensorflow separately using;

$ pip install tensorflow

which uninstalled setuptools-40.4.3 and installed setuptools-39.1.0

When I tried checking the version of the tensorflow using:

$ python -c 'import tensorflow as tf; print(tf.__version__)'

it again shows the above mentioned error.

chuyangliu commented 5 years ago

I think the problem is related to protobuf. I found the same issue here.

FYI, you can try reverting protobuf to version 3.6.0:

Running Windows 7, python 3.6.0 (Anaconda 4.3.0). I can confirm this same error message with protobuf 3.6.1 (protobuf 3.6.1 installed as part of an upgrade to tensorflow-gpu 1.10.0, and the error prevented tensorflow from successfully importing). I can also confirm that reverting to protobuf 3.6.0 allowed me to successfully import tensorflow (for those encountering the error this way and looking for a temporary solution).

luharinos commented 5 years ago

Yes, the earlier version of protobuf was 3.6.1, which I downgraded to 3.6.0, using:

$ pip uninstall protobuf
$ pip install protobuf==3.6.0

The game, now, works smooth and fine.

Thanks for your quick and kind help!