簡體   English   中英

在 VirtualBox Ubuntu 18.04 上使用 Rasa/Tensorflow 時出錯

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

我有一台裝有 Windows 10 Pro 和 Python 3.6 的筆記本電腦。

這是我的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

我正在處理的項目使用 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一個虛擬環境。

在此之后,如果我嘗試在 shell 上運行rasa train或在 python 控制台import tensorflow as tf ,則會出現錯誤:

Illegal instruction (core dumped)

關於此錯誤的原因可能是什么的任何想法? 我看到有人說這可能是tensorflow與所使用的處理器架構不兼容,但在我的情況下,這不應該是問題,因為一切都在 Windows 上運行(對嗎?)。

我還嘗試卸載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'

但是,在 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'

我錯過了什么嗎? 難道我做錯了什么?

提前致謝!

我看到有人說這可能是 tensorflow 與正在使用的處理器架構不兼容,但在我的情況下,這不應該是問題,因為一切都適用於 Windows(對嗎?)。

我認為這實際上可能是您的問題。 當您使用 VirtualBox 時,您不再處於與 windows 機器相同的環境中,並且您可能會遇到本地 windows 環境中沒有發生的不兼容問題。

找不到您從源代碼構建的模塊這一事實很可能是因為它不在您的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/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM