mikeyEcology / MLWIC

Machine Learning for Wildlife Image Classification
70 stars 16 forks source link

tensorflow() installation fails with sudo no tty error #5

Closed JepsonNomad closed 6 years ago

JepsonNomad commented 6 years ago

Hey mikeyEcology - My attempts to set up MLWIC on my macbook version 10.11.6 OSX El Capitan pulled an error at the tensorflow() stage with:

[1] "Python is installed. Installing homebrew, protobuf, pip, and tensorflow." ==> You are using macOS 10.11. ==> We (and Apple) do not provide support for this old version. This installation may not succeed. After installation, you will encounter build failures and other breakages. Please create pull-requests instead of asking for help on Homebrew's GitHub, Discourse, Twitter or IRC. As you are running this old version, you are responsible for resolving any issues you experience.

==> This script will install: /usr/local/bin/brew /usr/local/share/doc/homebrew /usr/local/share/man/man1/brew.1 /usr/local/share/zsh/site-functions/_brew /usr/local/etc/bash_completion.d/brew /usr/local/Homebrew ==> The following new directories will be created: /usr/local/Caskroom ==> /usr/bin/sudo /bin/mkdir -p /usr/local/Caskroom sudo: no tty present and no askpass program specified Failed during: /usr/bin/sudo /bin/mkdir -p /usr/local/Caskroom Warning: protobuf 3.6.1 is already installed and up-to-date To reinstall 3.6.1, run brew reinstall protobuf sudo: no tty present and no askpass program specified sudo: no tty present and no askpass program specified sudo: no tty present and no askpass program specified

As suggested in the (great, by the way) readme, I ignored the error and moved along through Steps 2-4 - but trying to use classify() with the example imagery yielded the error discussed for Windows here.

Edit: It isn't the same exact error as the Windows issue. setup() pulls Error 1:

UnsatisfiableError: The following specifications were found to be in conflict:

  • argparse
  • tensorflow Use "conda info " to see the dependencies for each package.

Error: Error 1 occurred installing packages into conda environment r-reticulate

Based on this source my assumption is that a password is required somewhere in this workflow but I'm not being prompted for one, and I don't know how to bypass that requirement.

Do you have any suggestions for where to go from here?

JepsonNomad commented 6 years ago

Through the terminal, I can run brew install tensorflow which does not pull any errors, but attempting to run classify() still pulls the error

Traceback (most recent call last): File "eval.py", line 13, in import tensorflow as tf ImportError: No module named tensorflow

mikeyEcology commented 6 years ago

Tensorflow is a new software that is frequently updated. It generally will only run on the latest operating systems. I recommend updating to OS 10.12 or greater. This should make the tensorflow function work and it should fix the error when you run classify.Do you have a restriction that is keeping you from updating your OS?

JepsonNomad commented 6 years ago

Woah - I hadn't realized how out of date my osx is. Our university IT people recommended holding off on Mojave for a bit to make sure packages have a chance to catch up but apparently there are several OSX's between El Capitan and Mojave. Will update to Sierra or High Sierra and update my issue.

JepsonNomad commented 6 years ago

Same problem persists on OSX version 10.13.6 High Sierra:

tensorflow() yielded the following errors:

==> /usr/bin/sudo /bin/mkdir -p /usr/local/Caskroom sudo: no tty present and no askpass program specified Failed during: /usr/bin/sudo /bin/mkdir -p /usr/local/Caskroom Updating Homebrew...

Warning: protobuf 3.6.1 is already installed and up-to-date To reinstall 3.6.1, run brew reinstall protobuf sudo: no tty present and no askpass program specified sudo: no tty present and no askpass program specified sudo: no tty present and no askpass program specified

setup(python_loc = "/Users/JepsonNomad/anaconda/bin/python", conda_loc = "/Users/JepsonNomad/anaconda/bin/conda") led to a single error (code 1) after listing the initial r-reticulate message:

Remove all packages in environment /Users/christianjohn/anaconda/envs/r-reticulate:

Solving environment: ...working... failed UnsatisfiableError: The following specifications were found to be in conflict:

  • argparse
    • tensorflow Use "conda info " to see the dependencies for each package. Error: Error 1 occurred installing packages into conda environment r-reticulate

And then classify() also failed:

Traceback (most recent call last): File "eval.py", line 13, in import tensorflow as tf ImportError: No module named tensorflow [1] "evaluation of images took 2.31614208221436 secs. The results are stored in /Users/JepsonNomad/Documents/mylab/L1/model_predictions.txt. To view the results in a viewer-friendly format, please use the function make_output"

mikeyEcology commented 6 years ago

Tensorflow is not installing properly on your machine and it looks like the problem is related to this output: sudo: no tty present and no askpass program specified. Do you have administrative control on your computer? If not, you might need to ask someone from your IT department to install tensforflow following the directions here.

JepsonNomad commented 6 years ago

I do have administrative control. I tried installing tensorflow using pip as per the instructions in your link, and it installed successfully. However, I still get the same error when running setup() in R.

mikeyEcology commented 6 years ago

You can ignore the errors in setup. Have you tried re-running classify since you installed tensorflow with pip?

JepsonNomad commented 6 years ago

Ok, classify now runs after the pip installation of tensorflow. There are a few runtime errors and warnings that spring up (see below) but the function operates as expected.

RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb WARNING:tensorflow:From /Users/JepsonNomad/anaconda/lib/python2.7/site-packages/tensorflow/python/training/input.py:187: init (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version. Instructions for updating: To construct input pipelines, use the tf.data module. WARNING:tensorflow:From /Users/JepsonNomad/anaconda/lib/python2.7/site-packages/tensorflow/python/training/input.py:187: add_queue_runner (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version. Instructions for updating: To construct input pipelines, use the tf.data module. WARNING:tensorflow:From eval.py:65: start_queue_runners (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version. Instructions for updating: To construct input pipelines, use the tf.data module.

mikeyEcology commented 6 years ago

Good. It sounds like you are up and running now.

christinamaiello commented 5 years ago

I'm running into the same problem that JepsonNomad had initially. I installed Anaconda3 5.2.0 (which runs Python 3.6) on a MacOS Mojave 10.14. I then installed the MLWIC package and attempted to run tensorflow() but received this error that suggests that tensorflow did not install:

Warning: protobuf 3.6.1.3_1 is already installed and up-to-date To reinstall 3.6.1.3_1, run brew reinstall protobuf sudo: no tty present and no askpass program specified sudo: no tty present and no askpass program specified sudo: no tty present and no askpass program specified

Then if I run classify() I get the same error JepsonNomad also had, again suggesting that tensorflow is either not installed or not being located:
File "eval.py", line 13, in import tensorflow as tf ModuleNotFoundError: No module named 'tensorflow'

I then tried to install tensorflow using the terminal window and various pip commands - but here is where I'm unclear - the link to the tensorflow install instructions gives several options: install into a virtual environment, install directly to the system, or install using conda. I have no knowledge of Python or Anaconda, so I'm not sure what the difference is here and which is the best method to use. I also don't know whether it matters what you name the virtual environment or exactly where you place it. Everything I've tried has so far produced the same result when attempting to run classify again after the install: ModuleNotFoundError: No module named 'tensorflow' . I just don't know what to do at this point.

I've also attempted to use this package on a laptop running Windows but I'm running to even more problems, so the Mac install seems like a better place to start. I've been trying this for days and getting nowhere.

If anyone has had success on a Mac, I'd love to know more details about the initial installation process (what version of anaconda was used, how was tensorflow installed, etc).