问题
So I am trying to install plaidML-keras so I can do tensor-flow stuff on my MacBookPro's gpu (radeon pro 560x). From my research, it can be done using plaidML-Keras (instalation instrutions). When I run pip install -U plaidml-keras
it works fine, but the next step, plaidml-setup
returns the following error.
Traceback (most recent call last):
File "/usr/local/bin/plaidml-setup", line 6, in <module>
from plaidml.plaidml_setup import main
File "/usr/local/lib/python3.7/site-packages/plaidml/__init__.py", line 50, in <module>
import plaidml.settings
File "/usr/local/lib/python3.7/site-packages/plaidml/settings.py", line 33, in <module>
_setup_config('PLAIDML_EXPERIMENTAL_CONFIG', 'experimental.json')
File "/usr/local/lib/python3.7/site-packages/plaidml/settings.py", line 30, in _setup_config
'Could not find PlaidML configuration file: "{}".'.format(filename))
plaidml.exceptions.PlaidMLError: Could not find PlaidML configuration file: "experimental.json".
From my limited understanding of the error message, it is saying that I am missing a conifuration file, but I don't know where to put it, or what to put in it. I am guessing that it has something to do with the following (vague) line from the instructions.
Finally, set up PlaidML to use a preferred computing device
But how do I specify that I want it to use the radeon pro 560x. Also, I did check and my mac is compatible with openCL 1.2 (required for plaidML)
回答1:
Disclaimer: I'm on the PlaidML team, and we're actively working to improve the setup experience and documentation around it. We're sorry you were stuck on this. For now, here's some instructions to get you back on track.
- Find out where plaidml-setup was installed. Typically, this is some variant of
/usr/local/bin
or a path to your virtual environment. The prefix of this path (i.e./usr/local
) is important to note for the next step. - Find the plaidml
share
directory. It's within the same prefix as plaidml-setup, i.e./usr/local/share/plaidml
. - Within the plaidml
share
directory, there should be a few files: at a minimum,config.json
andexperimental.json
should be in there. If they're not in there, you can copy the files here to your plaidmlshare
directory.
After copying those json files over, you should be able to run plaidml-setup
with no issue.
回答2:
I'm facing the same problem and answers online are not very helpful. In this case, I'd suggest debugging yourself.
Since this is where the problem is:
File "/usr/local/lib/python3.7/site-packages/plaidml/settings.py", line 30, in _setup_config
'Could not find PlaidML configuration file: "{}".'.format(filename))
You can vim /usr/local/lib/python3.7/site-packages/plaidml/settings.py
, and read the code. Basically it's trying to use function _find_config
to get config files.
After cfg_path = os.path.join(prefix, 'share', 'plaidml', name)
, I added print(cfg_path)
to see what path it's looking for. And I got:
/usr/local/Caskroom/miniconda/base/share/plaidml/experimental.json
/usr/local/Caskroom/miniconda/base/share/plaidml/config.json
This is why it's hard to tell you where to put the files: it depends on your system setup. Not everyone is using cask
and conda
like me, so I assume it should be different in your OS.
@Denise Kutnick: thanks for your hard work, maybe either print cfg_path when there's a problem, or try to add .
as a search path, so that it would be easier for users to get some clue?
回答3:
As I wrote here: https://superuser.com/questions/1404114/traceback-error-during-plaidml-installation/1488059#1488059
the file plaidml/settings.py
uses variable sys.prefix
which for a reason has wrong value for my system: it contains /usr
instead of ~/.local
so it tries to load /usr/share/plaidml/experimental.json
instead of ~/.local/share/plaidml/experimental.json
I don't know how to fix the value of sys.prefix
yet and whether plaidml will be able to find it's so
file...
来源:https://stackoverflow.com/questions/56973032/how-to-install-plaidml-plaidml-keras