0

I'm trying to run Keras on a Google Cloud Deep Learning VM instance using the Theano backend instead of the default Tensorflow one. I can ssh into the instance as the jupyter user and subsequently run pip install theano, just trying to import theano from the python prompt also works, but when I set the Keras backend to Theano in Jupyter Lab (via os.environ['KERAS_BACKEND'] = 'theano'), anytime I try to train a model I receive this strange error message:

ERROR (theano.gof.cmodule): [Errno 2] No such file or directory: '/opt/anaconda1anaconda2anaconda3/lib'

What's up with that?

Peter
  • 2,919
  • 1
  • 16
  • 35

1 Answers1

1

Something must have gone wrong during the installation, I suppose. The bad interpreter means that a script is looking for an interpreter that doesn't exist - as you rightfully pointed out.

The problem is likely to be in the shebang #! statement of your conda script.

From Wikipedia: Under Unix-like operating systems, when a script with a shebang is run as a program, the program loader parses the rest of the script's initial line as an interpreter directive; the specified interpreter program is run instead, passing to it as an argument the path that was initially used when attempting to run the script.

If you run

cat ~/anaconda3/bin/conda You will probably get the following:

!/opt/anaconda1anaconda2anaconda3/bin/python

if name == 'main': import sys import conda.cli

sys.exit(conda.cli.main())

Changing the first line to point a correct interpreter, i.e., changing it to:

!/home/lukasz/anaconda3/bin/python

Should make the conda command work.

If you are sure that you installed everything properly, then I'd suggest maybe reaching out for support from the anaconda community.

Answered by @dangom in conda command will prompt error: "Bad Interpreter: No such file or directory"

Atle Kristiansen
  • 707
  • 7
  • 28
  • Anaconda is not installed on that system (I should probably have mentioned that), I installed theano via `pip install theano`, that's what makes this so weird to me. – Peter Feb 14 '19 at 22:52
  • If you run the following code, what does it say? import sys print(sys.executable) – Atle Kristiansen Feb 14 '19 at 23:31
  • I already tried that, it's `/usr/bin/python3`, the system comes pre-configured but I'm certain there are no virtual python environments of any type set up. – Peter Feb 15 '19 at 01:01
  • I assume that you have tried a reinstall (of theano)? There are no python2 on the machine? – Atle Kristiansen Feb 16 '19 at 18:44