Closed Tom-Chen-Taiwan closed 2 years ago
Kia ora,
Is this from the edX class or is it a different environment? We're working on fixing the edX version now, so it would be helpful to know if this were a separate issue.
Cheers,
Jonathan
Hi! Jonathan!
It works fine in the environment provided by edx class. (https://labs.vocareum.com/main/main.php?m=editor&asnid=769861&stepid=769862&hideNavBar=1)
However, I want to install "TextAnalytics" in my own Jupyter Notebook by typing "pip install text_analytics", it shows up like the following:
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 Requirement already satisfied: text_analytics in /opt/homebrew/lib/python3.9/site-packages (1.0.2) Requirement already satisfied: six>=1.10 in /opt/homebrew/lib/python3.9/site-packages (from text_analytics) (1.16.0) Requirement already satisfied: python-dateutil in /opt/homebrew/lib/python3.9/site-packages (from text_analytics) (2.8.2) Requirement already satisfied: certifi in /opt/homebrew/lib/python3.9/site-packages (from text_analytics) (2021.10.8) Requirement already satisfied: urllib3>=1.15 in /opt/homebrew/lib/python3.9/site-packages (from text_analytics) (1.26.9) DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 Note: you may need to restart the kernel to use updated packages.
ModuleNotFoundError Traceback (most recent call last) Input In [4], in <cell line: 1>() ----> 1 from text_analytics import text_analytics 2 import pandas as pd 3 print("Done!")
File /opt/homebrew/lib/python3.9/site-packages/text_analytics/init.py:19, in
So, I tried to install the module by typing "pip install swagger_client", it shows up like the following:
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 ERROR: Could not find a version that satisfies the requirement swagger_client (from versions: none) ERROR: No matching distribution found for swagger_client Note: you may need to restart the kernel to use updated packages.
How should I solve this?
Thank you!
Try this pip install command:
pip install textanalytics
Unfortunately, "pip install text_analytics" is a different package. You might want to uninstall that other package as well to avoid future issues.
Hi! Jonathan!
When I run the following codes:
from text_analytics import text_analytics import os import pandas as pd print("Done!")
the following message shows up.
How can I solve this?
Thank you!
ImportError Traceback (most recent call last) File /opt/homebrew/lib/python3.9/site-packages/tensorflow/python/init.py:61, in
60 sys.setdlopenflags(_default_dlopen_flags | ctypes.RTLD_GLOBAL)
---> 61 from tensorflow.python import pywrap_tensorflow
62 sys.setdlopenflags(_default_dlopen_flags)
File /opt/homebrew/lib/python3.9/site-packages/tensorflow/python/pywrap_tensorflow.py:28, in
27 return _mod
---> 28 _pywrap_tensorflow = swig_import_helper()
29 del swig_import_helper
File /opt/homebrew/lib/python3.9/site-packages/tensorflow/python/pywrap_tensorflow.py:24, in swig_import_helper() 23 try: ---> 24 _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description) 25 finally:
File /opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/imp.py:242, in load_module(name, file, filename, details) 241 else: --> 242 return loaddynamic(name, filename, file) 243 elif type == PKG_DIRECTORY:
File /opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/imp.py:342, in load_dynamic(name, path, file) 340 spec = importlib.machinery.ModuleSpec( 341 name=name, loader=loader, origin=path) --> 342 return _load(spec)
ImportError: dlopen(/opt/homebrew/lib/python3.9/site-packages/tensorflow/python/_pywrap_tensorflow.so, 0x000A): tried: '/opt/homebrew/lib/python3.9/site-packages/tensorflow/python/_pywrap_tensorflow.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last) Input In [1], in <cell line: 1>() ----> 1 from text_analytics import text_analytics 2 import os 3 import pandas as pd
File /opt/homebrew/lib/python3.9/site-packages/text_analytics/text_analytics.py:27, in
25 from matplotlib import pyplot as plt
26 from wordcloud import WordCloud
---> 27 import tensorflow as tf
28 import spacy
30 #---------------------------------
File /opt/homebrew/lib/python3.9/site-packages/tensorflow/init.py:24, in
21 from future import print_function
23 # pylint: disable=wildcard-import
---> 24 from tensorflow.python import *
25 # pylint: enable=wildcard-import
26
27 # Lazily import the
tf.contrib
module. This avoids loading all of the 28 # dependencies oftf.contrib
atimport tensorflow
time. 29 class _LazyContribLoader(object):File /opt/homebrew/lib/python3.9/site-packages/tensorflow/python/init.py:72, in
67 except ImportError:
68 msg = """%s\n\nFailed to load the native TensorFlow runtime.\n
69 See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error\n
70 for some common reasons and solutions. Include the entire stack trace
71 above this error message when asking for help.""" % traceback.format_exc()
---> 72 raise ImportError(msg)
74 # Protocol buffers
75 from tensorflow.core.framework.graph_pb2 import *
ImportError: Traceback (most recent call last): File "/opt/homebrew/lib/python3.9/site-packages/tensorflow/python/init.py", line 61, in
from tensorflow.python import pywrap_tensorflow
File "/opt/homebrew/lib/python3.9/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in
_pywrap_tensorflow = swig_import_helper()
File "/opt/homebrew/lib/python3.9/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
File "/opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: dlopen(/opt/homebrew/lib/python3.9/site-packages/tensorflow/python/_pywrap_tensorflow.so, 0x000A): tried: '/opt/homebrew/lib/python3.9/site-packages/tensorflow/python/_pywrap_tensorflow.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
Failed to load the native TensorFlow runtime.
See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error
for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.