简体   繁体   English

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

[英]Error using Rasa/Tensorflow on VirtualBox Ubuntu 18.04

I have a laptop with Windows 10 Pro with Python 3.6.我有一台装有 Windows 10 Pro 和 Python 3.6 的笔记本电脑。

This is my pip freeze on Windows:这是我的pip freeze在 Windows 上:

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

The project I'm working on uses Rasa 1.6.0 and with these requirements, everything runs as expected on Windows.我正在处理的项目使用 Rasa 1.6.0 并且满足这些要求,一切都按预期在 Windows 上运行。

However, for a specific task, I need to be on Ubuntu and so I installed Ubuntu 18.04 on a VirtualBox 6.1 machine, installed python and pip and run pip install -r requirements.txt command to install the exact same requirements on that machine, inside a virtual environment. However, for a specific task, I need to be on Ubuntu and so I installed Ubuntu 18.04 on a VirtualBox 6.1 machine, installed python and pip and run pip install -r requirements.txt command to install the exact same requirements on that machine, inside一个虚拟环境。

After this, if I try to run rasa train on a shell or import tensorflow as tf on a python console, an error appears:在此之后,如果我尝试在 shell 上运行rasa train或在 python 控制台import tensorflow as tf ,则会出现错误:

Illegal instruction (core dumped)

Any ideias on what the cause for this error could be?关于此错误的原因可能是什么的任何想法? I saw some people saying it could be some incompatibility of tensorflow with the architecture of the processor being used, however in my case that should not be the problem since everything works on Windows (right?).我看到有人说这可能是tensorflow与所使用的处理器架构不兼容,但在我的情况下,这不应该是问题,因为一切都在 Windows 上运行(对吗?)。

I also tried to uninstall tensorflow and followed some online tutorials to Build from source but now, when I run rasa --version , tensorflow is no longer found:我还尝试卸载tensorflow并按照一些在线教程Build from source但现在,当我运行rasa --version时,不再找到tensorflow

$ 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'

But, inside a Python console, I can import tensorflow but if I try so access anything, other errors are shown:但是,在 Python 控制台中,我可以导入tensorflow但如果我尝试访问任何内容,则会显示其他错误:

>>> 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'

Am I missing anything?我错过了什么吗? Am I doing something wrong?难道我做错了什么?

Thanks in advance!提前致谢!

I saw some people saying it could be some incompatibility of tensorflow with the architecture of the processor being used, however in my case that should not be the problem since everything works on Windows (right?).我看到有人说这可能是 tensorflow 与正在使用的处理器架构不兼容,但在我的情况下,这不应该是问题,因为一切都适用于 Windows(对吗?)。

I think this may in fact be your problem.我认为这实际上可能是您的问题。 When you're using VirtualBox, you're no longer in the same environment as on your windows machine, and you could be running into incompatibilities there that were not happening in your local windows environment.当您使用 VirtualBox 时,您不再处于与 windows 机器相同的环境中,并且您可能会遇到本地 windows 环境中没有发生的不兼容问题。

The fact that the module you built from source is not found, is most likely because it isn't in your PYTHONPATH .找不到您从源代码构建的模块这一事实很可能是因为它不在您的PYTHONPATH中。

I would recommend using a virtual environment and following eg these instructions for installing tensorflow on Ubuntu, since that's what your VirtualBox is running: https://linuxize.com/post/how-to-install-tensorflow-on-ubuntu-18-04/ I would recommend using a virtual environment and following eg these instructions for installing tensorflow on Ubuntu, since that's what your VirtualBox is running: https://linuxize.com/post/how-to-install-tensorflow-on-ubuntu-18- 04/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM