connorcoley / rexgen_direct

Template-free prediction of organic reaction outcomes
GNU General Public License v3.0
151 stars 69 forks source link

AttributeError: module 'tensorflow' has no attribute 'placeholder' #13

Closed c10211 closed 4 years ago

c10211 commented 4 years ago

After running 'python manage.py runserver' in the appropriate folder I get the above error. The full error log below:

(my-rdkit-env) username@username-MacBook-Pro website % python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

2.2.0
['/Users/username/Project/rexgen_direct-master/website', '/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python37.zip', '/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7', '/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/lib-dynload', '/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages', '/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/IPython/extensions']
2.2.0
['/Users/username/Project/rexgen_direct-master/website', '/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python37.zip', '/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7', '/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/lib-dynload', '/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages', '/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/IPython/extensions', '/Users/username/Project/rexgen_direct-master']
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper
    fn(*args, **kwargs)
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
    self.check(display_num_errors=True)
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/django/core/management/base.py", line 395, in check
    include_deployment_checks=include_deployment_checks,
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/django/core/management/base.py", line 382, in _run_checks
    return checks.run_checks(**kwargs)
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/django/urls/resolvers.py", line 407, in check
    for pattern in self.url_patterns:
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/django/urls/resolvers.py", line 588, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/django/urls/resolvers.py", line 581, in urlconf_module
    return import_module(self.urlconf_name)
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/username/Project/rexgen_direct-master/website/tffp/urls.py", line 22, in <module>
    path(r'visualize/', include('visualize.urls')),
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/site-packages/django/urls/conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "/Users/username/opt/anaconda3/envs/my-rdkit-env/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/username/Project/rexgen_direct-master/website/visualize/urls.py", line 3, in <module>
    from . import views
  File "/Users/username/Project/rexgen_direct-master/website/visualize/views.py", line 3, in <module>
    from .data import do_index
  File "/Users/username/Project/rexgen_direct-master/website/visualize/data.py", line 46, in <module>
    directcorefinder.load_model()
  File "/Users/username/Project/rexgen_direct-master/rexgen_direct/core_wln_global/directcorefinder.py", line 39, in load_model
    input_atom = tf.placeholder(tf.float32, [batch_size, None, adim])
AttributeError: module 'tensorflow' has no attribute 'placeholder'

The terminal stays active i.e. I cannot enter another command unless manually shutting down this process, but the localhost webpage never shows up.

This is on a Mac if it helps, and I installed RDKit through Anaconda

connorcoley commented 4 years ago

My guess is that you're using Tensorflow 2, while this code was developed/tested with Tensorflow 1 where tf.placeholder is defined

c10211 commented 4 years ago

You're absolutely right, I am