首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在VirtualBox Ubuntu 18.04上使用Rasa/Tensorflow时出错

在VirtualBox Ubuntu 18.04上使用Rasa/Tensorflow时出错
EN

Stack Overflow用户
提问于 2021-02-25 21:03:12
回答 1查看 233关注 0票数 0

我有一台装有Windows 10 Pro和Python 3.6的笔记本电脑。

这是我在Windows上的pip freeze

代码语言:javascript
复制
numpy==1.19.5
absl-py==0.10.0
aiofiles==0.6.0
aiohttp==3.7.3
APScheduler==3.6.3
astor==0.8.1
async-generator==1.10
async-timeout==3.0.1
attrs==20.3.0
bidict==0.21.2
blis==0.7.4
boto3==1.16.50
botocore==1.19.50
bz2file==0.98
cached-property==1.5.2
cachetools==4.2.0
catalogue==1.0.0
certifi==2020.12.5
cffi==1.14.4
chardet==3.0.4
click==7.1.2
cloudpickle==1.6.0
colorama==0.4.4
colorclass==2.2.0
coloredlogs==10.0
colorhash==1.0.3
ConfigArgParse==1.2.3
contextvars==2.4
cryptography==3.3.1
cycler==0.10.0
cymem==2.0.5
dataclasses==0.8
decorator==4.4.2
dill==0.3.3
dnspython==1.16.0
docopt==0.6.2
dopamine-rl==3.0.1
fbmessenger==6.0.0
Flask==1.1.2
future==0.18.2
gast==0.2.2
gevent==1.5.0
gin-config==0.4.0
google-api-core==1.24.1
google-api-python-client==1.12.8
google-auth==1.24.0
google-auth-httplib2==0.0.4
google-pasta==0.2.0
googleapis-common-protos==1.52.0
greenlet==0.4.17
grpcio==1.34.0
gunicorn==20.0.4
gym==0.18.0
h11==0.8.1
h2==3.2.0
h5py==3.1.0
hpack==3.0.0
hstspreload==2020.12.22
httpcore==0.3.0
httplib2==0.18.1
httptools==0.1.1
httpx==0.9.3
humanfriendly==9.1
hyperframe==5.2.0
idna==2.10
idna-ssl==1.1.0
immutables==0.14
importlib-metadata==3.3.0
importlib-resources==4.1.1
itsdangerous==1.1.0
Jinja2==2.11.2
jmespath==0.10.0
jsonpickle==1.4.2
jsonschema==3.2.0
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.2
kfac==0.2.0
kiwisolver==1.3.1
Markdown==3.3.3
MarkupSafe==1.1.1
matplotlib==3.3.3
mattermostwrapper==2.2
mesh-tensorflow==0.1.18
mpmath==1.1.0
multidict==4.6.1
murmurhash==1.0.5
networkx==2.3
oauth2client==4.1.3
opencv-python==4.5.1.48
opt-einsum==3.3.0
packaging==19.2
pika==1.0.1
Pillow==7.2.0
plac==1.1.3
preshed==3.0.5
promise==2.3
prompt-toolkit==3.0.9
protobuf==3.14.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
pydot==1.4.1
pyglet==1.5.0
PyJWT==1.7.1
pykwalify==1.7.0
pymongo==3.11.2
pyparsing==2.4.7
pypng==0.0.20
pyreadline==2.1
pyrsistent==0.17.3
python-crfsuite==0.9.7
python-dateutil==2.8.1
python-engineio==4.0.0
python-socketio==5.0.4
python-telegram-bot==11.1.0
pytz==2019.3
PyYAML==5.3.1
questionary==1.9.0
rasa==1.6.0
rasa-sdk==1.6.1
redis==3.3.11
requests==2.25.1
requests-async==0.5.0
requests-toolbelt==0.9.1
rfc3986==1.4.0
rocketchat-API==0.6.36
rsa==4.6
ruamel.yaml==0.15.100
s3transfer==0.3.3
sanic==19.9.0
Sanic-Cors==0.9.9.post1
sanic-jwt==1.5.0
Sanic-Plugins-Framework==0.9.4.post1
scikit-learn==0.20.4
scipy==1.5.4
six==1.15.0
sklearn-crfsuite==0.3.6
slackclient==1.3.2
sniffio==1.2.0
spacy==2.3.5
SQLAlchemy==1.3.22
srsly==1.0.5
sympy==1.7.1
tabulate==0.8.7
tensor2tensor==1.14.1
tensorboard==1.15.0
tensorflow==1.15.3
tensorflow-datasets==3.1.0
tensorflow-estimator==1.15.1
tensorflow-gan==2.0.0
tensorflow-hub==0.11.0
tensorflow-metadata==0.26.0
tensorflow-probability==0.7.0
termcolor==1.1.0
terminaltables==3.1.0
thinc==7.4.5
tqdm==4.55.1
twilio==6.50.1
typing-extensions==3.7.4.3
tzlocal==2.1
uritemplate==3.0.1
urllib3==1.26.2
wasabi==0.8.0
wcwidth==0.2.5
webexteamssdk==1.6
websocket-client==0.54.0
websockets==8.1
Werkzeug==1.0.1
wrapt==1.12.1
yarl==1.6.3
zipp==3.4.0

我正在做的项目使用Rasa 1.6.0,满足了这些要求,一切都可以在Windows上正常运行。

然而,对于特定的任务,我需要在Ubuntu上运行,所以我在VirtualBox 6.1机器上安装了Ubuntu18.04,安装了pythonpip,并在虚拟环境中运行pip install -r requirements.txt命令在该机器上安装了完全相同的要求。

在此之后,如果我尝试在shell上运行rasa train或在python控制台上运行import tensorflow as tf,则会出现一个错误:

代码语言:javascript
复制
Illegal instruction (core dumped)

你知道这个错误的原因是什么吗?我看到一些人说这可能是tensorflow与正在使用的处理器的架构不兼容,但在我的例子中,这不应该是问题,因为一切都可以在Windows上运行(对吗?)。

我还尝试卸载tensorflow,并按照一些在线教程访问了Build from source,但现在,当我运行rasa --version时,再也找不到tensorflow了:

代码语言:javascript
复制
$ rasa --version
Traceback (most recent call last):
  File "/home/<USER>/Desktop/venv_rasa/bin/rasa", line 8, in <module>
    sys.exit(main())
  File "/home/<USER>/Desktop/venv_rasa/lib/python3.6/site-packages/rasa/__main__.py", line 69, in main
    set_log_level(log_level)
  File "/home/<USER>/Desktop/venv_rasa/lib/python3.6/site-packages/rasa/utils/common.py", line 68, in set_log_level
    update_tensorflow_log_level()
  File "/home/<USER>/Desktop/venv_rasa/lib/python3.6/site-packages/rasa/utils/common.py", line 108, in update_tensorflow_log_level
    import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'

但是,在Python控制台中,我可以导入tensorflow,但如果我尝试访问任何内容,则会显示其他错误:

代码语言:javascript
复制
>>> import tensorflow as tf
>>> tf.__version__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute '__version__'
>>> 
>>> mnist = tf.keras.datasets.mnist
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute 'keras'

我错过了什么吗?我做错了什么吗?

提前感谢!

EN

回答 1

Stack Overflow用户

发布于 2021-03-04 23:50:57

我看到一些人说这可能是tensorflow与正在使用的处理器的架构不兼容,但在我的情况下,这不应该是问题,因为一切都可以在Window上运行(对吗?)。

我认为这实际上可能是你的问题。当您使用VirtualBox时,您将不再处于与windows计算机相同的环境中,并且您可能会遇到在本地windows环境中不会发生的不兼容问题。

没有找到您从源代码构建的模块,很可能是因为它不在您的PYTHONPATH中。

我建议使用虚拟环境,并遵循以下说明在Ubuntu上安装tensorflow,因为这是您的VirtualBox正在运行的:https://linuxize.com/post/how-to-install-tensorflow-on-ubuntu-18-04/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66369027

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档