In the pull requests, I see that master branch has code which works with TF2. I am looking into how to use them.
I use a conda env with python 3.7.7 and tf 2.2. Then I pulled master branch from gihub celverhans. But, when I try to run mnist_tutorial_tfe.py, I get the following error.
$ python ./cleverhans_tutorials/mnist_tutorial_tfe.py
Traceback (most recent call last):
File "./cleverhans_tutorials/mnist_tutorial_tfe.py", line 23, in <module>
from cleverhans.utils_tfe import train, model_eval
File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/utils_tfe.py", line 17, in <module>
from cleverhans.loss import LossCrossEntropy
File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/loss.py", line 10, in <module>
from cleverhans.attacks import Attack
File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/attacks/__init__.py", line 12, in <module>
from cleverhans.attacks.attack import Attack
File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/attacks/attack.py", line 13, in <module>
from cleverhans.model import Model
File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/model.py", line 9, in <module>
from cleverhans import utils_tf
File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/utils_tf.py", line 345, in <module>
loss_collection=tf.GraphKeys.REGULARIZATION_LOSSES):
AttributeError: module 'tensorflow' has no attribute 'GraphKeys'
How can I use cleverhans with TF2? It seems the relevant code is under cleverhans/future directory. But how to make these official examples run under TF2?
Related
I've been trying to get odoo 15 to work for a bit while and after installing all dependencies and trying to run the app I've come into this error.
Traceback (most recent call last):
File "C:\odoo-15-test\server\odoo-bin", line 4, in <module>
import odoo
File "C:\odoo-15-test\server\odoo\__init__.py", line 11, in <module>
from . import http
File "C:\odoo-15-test\server\odoo\http.py", line 50, in <module>
from .service.server import memory_info
File "C:\odoo-15-test\server\odoo\service\__init__.py", line 4, in <module>
from . import common
File "C:\odoo-15-test\server\odoo\service\common.py", line 6, in <module>
import odoo.tools
File "C:\odoo-15-test\server\odoo\tools\__init__.py", line 21, in <module>
from .convert import *
File "C:\odoo-15-test\server\odoo\tools\convert.py", line 33, in <module>
from odoo import SUPERUSER_ID, api
File "C:\odoo-15-test\server\odoo\api.py", line 1022, in <module>
from odoo import SUPERUSER_ID
ImportError: cannot import name 'SUPERUSER_ID' from partially initialized module 'odoo' (most likely due to a circular import) (C:\odoo-15-test\server\odoo\__init__.py)
I have tried installing odoo with 'pip install odoo' but this didnt work and I don't see this being the problem. I have also never run into circular imports before so any help would be great thanks.
I installed tensorflow gpu one day ago at that time it was working fine, but now when I am trying to launch the notebook i am getting following error.
Traceback (most recent call last):
File "C:\Users\sumanta\anaconda3\envs\tf_2.5\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Users\sumanta\anaconda3\envs\tf_2.5\lib\site-packages\notebook\notebookapp.py", line 80, in <module>
from .services.contents.manager import ContentsManager
File "C:\Users\sumanta\anaconda3\envs\tf_2.5\lib\site-packages\notebook\services\contents\manager.py", line 17, in <module>
from nbformat import sign, validate as validate_nb, ValidationError
File "C:\Users\sumanta\anaconda3\envs\tf_2.5\lib\site-packages\nbformat\__init__.py", line 32, in <module>
from .validator import validate, ValidationError
File "C:\Users\sumanta\anaconda3\envs\tf_2.5\lib\site-packages\nbformat\validator.py", line 12, in <module>
from .json_compat import get_current_validator, ValidationError
File "C:\Users\sumanta\anaconda3\envs\tf_2.5\lib\site-packages\nbformat\json_compat.py", line 10, in <module>
import jsonschema
File "C:\Users\sumanta\anaconda3\envs\tf_2.5\lib\site-packages\jsonschema\__init__.py", line 14, in <module>
from jsonschema._format import (
File "C:\Users\sumanta\anaconda3\envs\tf_2.5\lib\site-packages\jsonschema\_format.py", line 240, in <module>
#_checks_drafts(draft7="idn-hostname", raises=idna.IDNAError)
AttributeError: module 'idna' has no attribute 'IDNAError'
A very, very basic solution - but what fixed this a while back for me was pip install idna. Give it a shot.
I am currently using the Google core dev board and using Putty to enter the code.
While performing the code, I got the error as below.
Traceback (most recent call last):
File "tools/generate_detections.py", line 7, in <module>
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
So I typed sudo pip install tensorflow.
but I got another error as below.
Traceback (most recent call last):
File "/home/mendel/.local/bin/pip", line 6, in <module>
from pip._internal.cli.main import main
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/configuration.py", line 27, in <module>
from pip._internal.utils.misc import ensure_dir, enum
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/utils/misc.py", line 42, in <module>
from pip._internal.locations import get_major_minor_version, site_packages, user_site
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/locations/__init__.py", line 14, in <module>
from . import _distutils, _sysconfig
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/locations/_distutils.py", line 9, in <module>
from distutils.cmd import Command as DistutilsCommand
ModuleNotFoundError: No module named 'distutils.cmd'
So I typed sudo apt install python3-distutils.
but I got another error as below.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python3-distutils is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libpython3.7-stdlib
E: Package 'python3-distutils' has no installation candidate
I can no longer find a solution.
Is there anyone who can help me?
sudo apt install python3-distutils
Just install in your Ubuntu terminal after you can install other packages!
I was trying out QuotesSpider example given in docs (page# 5, here), but am having a hard time to get it running. I installed scrapy from conda in the root environment. I am on Ubuntu 14.04, 64 bit machine. As soon as I run the given code snippet with the following command:
$ scrapy runspider quotes_spider.py -o quotes.json
I get the following error:
Traceback (most recent call last):
File "/home/rip/miniconda2/bin/scrapy", line 4, in <module>
import scrapy.cmdline
File "/home/rip/miniconda2/lib/python2.7/site-packages/scrapy/__init__.py", line 34, in <module>
from scrapy.spiders import Spider
File "/home/rip/miniconda2/lib/python2.7/site-packages/scrapy/spiders/__init__.py", line 10, in <module>
from scrapy.http import Request
File "/home/rip/miniconda2/lib/python2.7/site-packages/scrapy/http/__init__.py", line 11, in <module>
from scrapy.http.request.form import FormRequest
File "/home/rip/miniconda2/lib/python2.7/site-packages/scrapy/http/request/form.py", line 9, in <module>
import lxml.html
File "/home/rip/miniconda2/lib/python2.7/site-packages/lxml/html/__init__.py", line 54, in <module>
from .. import etree
ImportError: libiconv.so.2: cannot open shared object file: No such file or directory
As apparent, an object file seems to be missing. Do I have to build scrapy from source, or is there an alternative?
I tried to do the set up procedure to run inception V3 model on gcloud using Kubernetes. I did all the steps in the following link and successfully did the job. (https://tensorflow.github.io/serving/serving_inception)
When I tried the last command to query the service at its external address from our local host with my own image address using the following command:
($ bazel-bin/tensorflow_serving/example/inception_client --server=104.155.184.157:9000 --image= MY_IMAGE_ADDRESS
)
I got the following error:
serving/bazel-bin/tensorflow_serving/example/inception_client --server=104.155.184.157:9000 --image=/path/to/my_cat_image.jpg
Traceback (most recent call last):
File "/home/pouyanj/serving/bazel-bin/tensorflow_serving/example/inception_client.runfiles/tf_serving/tensorflow_serving/example/inception_client.py", line 24, in <module>
import tensorflow as tf
File "/home/pouyanj/serving/bazel-bin/tensorflow_serving/example/inception_client.runfiles/org_tensorflow/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/pouyanj/serving/bazel-bin/tensorflow_serving/example/inception_client.runfiles/org_tensorflow/tensorflow/python/__init__.py", line 36, in <module>
import _pywrap_tensorflow
ImportError: No module named _pywrap_tensorflow
Can anyone help me with that?