Stanford-STAGES / stanford-stages

Automated sleep staging scoring and narcolepsy identification
76 stars 26 forks source link

verify_chp_040.sh fails #15

Closed RaghavRao closed 4 years ago

RaghavRao commented 4 years ago

When running verify_chp_040.sh, it fails with:


2020-03-02 20:18:49.073738: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer.so.6'; dlerror: libnvinfer.so.6: cannot open shared object file: No such file or directory
2020-03-02 20:18:49.073821: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer_plugin.so.6'; dlerror: libnvinfer_plugin.so.6: cannot open shared object file: No such file or directory
2020-03-02 20:18:49.073835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:30] Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
Traceback (most recent call last):
  File "inf_narco_app.py", line 20, in <module>
    import gpflow as gpf
  File "/home/raghav/Envs/stanford-stages/lib/python3.7/site-packages/gpflow/__init__.py", line 21, in <module>
    from .session_manager import get_session
  File "/home/raghav/Envs/stanford-stages/lib/python3.7/site-packages/gpflow/session_manager.py", line 31, in <module>
    class TracerSession(tf.Session):
AttributeError: module 'tensorflow' has no attribute 'Session'

I tried installing tensorflow_gpu to fix this as suggested by other threads but this did not fix it. Is an Nvidia gpu required to run the code? I do not see anything in the readme about GPU or tensorflow_RT and was hoping for some guidance

informaton commented 4 years ago

You will need an NVIDIA GPU if you are installing and using the tensorflow_gpu module. If you don't have a supported GPU, then just go with the cpu version of tensorflow (i.e. just 'tensorflow').

Instructions for installing Tensorflow can be found on their website here. It has links to installing GPU support as well and links to NVIDIA's website for CUDA enabled GPU cards that are supported.

Note, the master branch for stanford-stages works with TensorFlow version 1.9.0 (see note below).

It looks like you are using a more recent version of TensorFlow which has removed the "Session" attribute (e.g. you are likley using TensorFlow 2.0 or later), and is no longer compatible with this mater branch. Currently, the 'beta' branch is in development to support TensorFlow 2.0.

Software requirements and instructions for the master branch can be found here.

Module First reference Version
numpy inf_narco_app.py 1.14.5
scipy inf_narco_app.py 1.1.0
gpflow inf_narco_app.py 1.2.0
tensorflow inf_narco_app.py 1.9.0
pyedflib inf_hypnodensity.py 0.1.13
pywt inf_hypnodensity.py 1.0.6
samplerate inf_hypnodensity.py 0.1.0
RaghavRao commented 4 years ago

Thank you.

I do not have an nvidia GPU and will use the CPU instead.

I get the following error when installing tensorflow 1.9.0:


ERROR: Could not find a version that satisfies the requirement tensorflow==1.9.0 (from versions: 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 1.15.0rc0, 1.15.0rc1, 1.15.0rc2, 1.15.0rc3, 1.15.0, 1.15.2, 2.0.0a0, 2.0.0b0, 2.0.0b1, 2.0.0rc0, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.1.0rc0, 2.1.0rc1, 2.1.0rc2, 2.1.0)
ERROR: No matching distribution found for tensorflow==1.9.0

I am on Linux x86_64 python 3.7.6.

Can I use one of the other versions?

informaton commented 4 years ago

Thanks for the update on the python version and operating system. Let me check and see if another one will work. It may be another day or two to find out/respond.

RaghavRao commented 4 years ago

Hi, Did you have any luck? Is there another python version I can try?

informaton commented 4 years ago

I was able to install everything on a new system and found the original requirements still held for Python 3.6.8

These also worked

Module Version
tensorflow 1.10.0, 1.11.0, 1.12.0
numpy 1.14.5,
scikit-image 0.14.1
pyedflib 0.1.12
pywavelets 1.1.1
samplerate Replaced by scipy.signal methods.

Unfortunately, later versions of tensorflow (e.g. 1.12.2/3, 1.13.x, etc) require a later version of numpy (e.g. numpy 1.18.2), which is not backward compatible with the code here.

RaghavRao commented 4 years ago

Just to confirm, did you mean scikit image 0.14.5?

Edit: 0.14.5 works.

I would recommend editing the original requirements to change from python >= 3.6 to be python>=3.6 but python <=3.6.10 (On fedora 31, python36 is python 3.6.10)

The dependencies that worked for me are:

requirements.txt

This can be added to the repo so users can just do pip install -r requirements.txt

I verified that that the file works in a new virtualenv.

informaton commented 4 years ago

Thanks for the dependencies text file. I'll add that shortly. I had the wrong scikit image version earlier, somehow mixed up with the numpy version. I meant scikit-image 0.14.1, and am glad to know 0.14.5 works as well. I corrected the table above and added a modified version of the requirements.txt file to commit d05a468.

Did you find that Python 3.7 did not hold for you? We know of inconsistent results seen with Python 3.5. I see earlier that I thought you were wondering if there was a different version of Tensorflow that would work, and did not investigate higher versions of Python. We have seen differences in calculations done using Python 3.5.