alex-ber / alpine-anaconda3 Goto Github PK
View Code? Open in Web Editor NEWAlpine Linux based image with Python 3.7 and necessary OS level dependencies (OpenSSL, gcc, ODBC driver, etc).
License: BSD 2-Clause "Simplified" License
Alpine Linux based image with Python 3.7 and necessary OS level dependencies (OpenSSL, gcc, ODBC driver, etc).
License: BSD 2-Clause "Simplified" License
`
#!/usr/bin/python3
#taken from https://python.gotrained.com/tf-idf-twitter-sentiment-analysis/
import numpy as np
import pandas as pd
import re
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
tweets = pd.read_csv("https://raw.githubusercontent.com/kolaveridi/kaggle-Twitter-US-Airline-Sentiment-/master/Tweets.csv")
print(tweets.head())
print(tweets.shape)
import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
import seaborn as sns
sns.countplot(x='airline_sentiment', data=tweets)
plt.savefig("/opt/project/emrpythonconnect/figure_1")
sns.countplot(x='airline', data=tweets)
plt.savefig("/opt/project/emrpythonconnect/figure_2")
sns.countplot(x='airline', hue="airline_sentiment", data=tweets)
plt.savefig("/opt/project/emrpythonconnect/figure_3")
X = tweets.iloc[:, 10].values
y = tweets.iloc[:, 1].values
processed_tweets = []
for tweet in range(0, len(X)):
# Remove all the special characters
processed_tweet = re.sub(r'\W', ' ', str(X[tweet]))
# remove all single characters
processed_tweet = re.sub(r'\s+[a-zA-Z]\s+', ' ', processed_tweet)
# Remove single characters from the start
processed_tweet = re.sub(r'\^[a-zA-Z]\s+', ' ', processed_tweet)
# Substituting multiple spaces with single space
processed_tweet= re.sub(r'\s+', ' ', processed_tweet, flags=re.I)
# Removing prefixed 'b'
processed_tweet = re.sub(r'^b\s+', '', processed_tweet)
# Converting to Lowercase
processed_tweet = processed_tweet.lower()
processed_tweets.append(processed_tweet)
from sklearn.feature_extraction.text import TfidfVectorizer
tfidfconverter = TfidfVectorizer(max_features=2000, min_df=5, max_df=0.7, stop_words=stopwords.words('english'))
X = tfidfconverter.fit_transform(processed_tweets).toarray()
`
Traceback (most recent call last):
File "/opt/anaconda3/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3417, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
runfile('/opt/project/emrpythonconnect/check2.py', wdir='/opt/project/emrpythonconnect')
File "/opt/.pycharm_helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/opt/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/opt/project/emrpythonconnect/check2.py", line 8, in
import nltk
File "/opt/anaconda3/lib/python3.8/site-packages/nltk/init.py", line 143, in
from nltk.chunk import *
File "/opt/anaconda3/lib/python3.8/site-packages/nltk/chunk/init.py", line 157, in
from nltk.chunk.api import ChunkParserI
File "/opt/anaconda3/lib/python3.8/site-packages/nltk/chunk/api.py", line 13, in
from nltk.parse import ParserI
File "/opt/anaconda3/lib/python3.8/site-packages/nltk/parse/init.py", line 100, in
from nltk.parse.transitionparser import TransitionParser
File "/opt/anaconda3/lib/python3.8/site-packages/nltk/parse/transitionparser.py", line 22, in
from sklearn.datasets import load_svmlight_file
File "/opt/anaconda3/lib/python3.8/site-packages/sklearn/init.py", line 64, in
from .base import clone
File "/opt/anaconda3/lib/python3.8/site-packages/sklearn/base.py", line 14, in
from .utils.fixes import signature
File "/opt/anaconda3/lib/python3.8/site-packages/sklearn/utils/init.py", line 14, in
from . import _joblib
File "/opt/anaconda3/lib/python3.8/site-packages/sklearn/utils/_joblib.py", line 22, in
from ..externals import joblib
File "/opt/anaconda3/lib/python3.8/site-packages/sklearn/externals/joblib/init.py", line 119, in
from .parallel import Parallel
File "/opt/anaconda3/lib/python3.8/site-packages/sklearn/externals/joblib/parallel.py", line 28, in
from ._parallel_backends import (FallbackToBackend, MultiprocessingBackend,
File "/opt/anaconda3/lib/python3.8/site-packages/sklearn/externals/joblib/_parallel_backends.py", line 22, in
from .executor import get_memmapping_executor
File "/opt/anaconda3/lib/python3.8/site-packages/sklearn/externals/joblib/executor.py", line 14, in
from .externals.loky.reusable_executor import get_reusable_executor
File "/opt/anaconda3/lib/python3.8/site-packages/sklearn/externals/joblib/externals/loky/init.py", line 12, in
from .backend.reduction import set_loky_pickler
File "/opt/anaconda3/lib/python3.8/site-packages/sklearn/externals/joblib/externals/loky/backend/reduction.py", line 125, in
from sklearn.externals.joblib.externals import cloudpickle # noqa: F401
File "/opt/anaconda3/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/init.py", line 3, in
from .cloudpickle import *
File "/opt/anaconda3/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py", line 167, in
_cell_set_template_code = _make_cell_set_template_code()
File "/opt/anaconda3/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py", line 148, in _make_cell_set_template_code
return types.CodeType(
TypeError: an integer is required (got type bytes)
import pandas as pd
from nltk.corpus import stopwords
print(stopwords.words('english'))
Failed with:
Traceback (most recent call last):
File "/opt/anaconda3/lib/python3.8/site-packages/nltk/corpus/util.py", line 86, in __load
root = nltk.data.find('{}/{}'.format(self.subdir, zip_name))
File "/opt/anaconda3/lib/python3.8/site-packages/nltk/data.py", line 701, in find
raise LookupError(resource_not_found)
LookupError:
Resource stopwords not found.
Please use the NLTK Downloader to obtain the resource:
import nltk
nltk.download('stopwords')
For more information see: https://www.nltk.org/data.html
Attempted to load corpora/stopwords.zip/stopwords/
Searched in:
- '/root/nltk_data'
- '/opt/anaconda3/nltk_data'
- '/opt/anaconda3/share/nltk_data'
- '/opt/anaconda3/lib/nltk_data'
- '/usr/share/nltk_data'
- '/usr/local/share/nltk_data'
- '/usr/lib/nltk_data'
- '/usr/local/lib/nltk_data'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/anaconda3/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3417, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
runfile('/opt/project/emrpythonconnect/check2.py', wdir='/opt/project/emrpythonconnect')
File "/opt/.pycharm_helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/opt/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/opt/project/emrpythonconnect/check2.py", line 11, in
print(stopwords.words('english'))
File "/opt/anaconda3/lib/python3.8/site-packages/nltk/corpus/util.py", line 123, in getattr
self.__load()
File "/opt/anaconda3/lib/python3.8/site-packages/nltk/corpus/util.py", line 88, in __load
raise e
File "/opt/anaconda3/lib/python3.8/site-packages/nltk/corpus/util.py", line 83, in __load
root = nltk.data.find('{}/{}'.format(self.subdir, self.__name))
File "/opt/anaconda3/lib/python3.8/site-packages/nltk/data.py", line 701, in find
raise LookupError(resource_not_found)
LookupError:
Resource stopwords not found.
Please use the NLTK Downloader to obtain the resource:
import nltk
nltk.download('stopwords')
For more information see: https://www.nltk.org/data.html
Attempted to load corpora/stopwords
Searched in:
- '/root/nltk_data'
- '/opt/anaconda3/nltk_data'
- '/opt/anaconda3/share/nltk_data'
- '/opt/anaconda3/lib/nltk_data'
- '/usr/share/nltk_data'
- '/usr/local/share/nltk_data'
- '/usr/lib/nltk_data'
- '/usr/local/lib/nltk_data'
pip install numpy==1.20.3 success
pip install scipy==1.5.4
`
Collecting scipy==1.5.4
Downloading scipy-1.5.4.tar.gz (25.2 MB)
|████████████████████████████████| 25.2 MB 5.7 MB/s
Installing build dependencies ... \ done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python /usr/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpvkfinqgv
cwd: /tmp/pip-install-ut7y17vq/scipy_018ac8e531bf44fa856ffc58cd6060a6
Complete output (234 lines):
setup.py:460: UserWarning: Unrecognized setuptools command ('dist_info --egg-base /tmp/pip-modern-metadata-7ysq6nl2'), proceeding with generating Cython sources and expanding templates
warnings.warn("Unrecognized setuptools command ('{}'), proceeding with "
Running from SciPy source directory.
lapack_opt_info:
lapack_mkl_info:
customize UnixCCompiler
libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
openblas_lapack_info:
customize UnixCCompiler
customize UnixCCompiler
libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
openblas_clapack_info:
customize UnixCCompiler
customize UnixCCompiler
libraries openblas,lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
flame_info:
customize UnixCCompiler
libraries flame not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
customize UnixCCompiler
libraries lapack_atlas not found in /usr/local/lib
customize UnixCCompiler
libraries tatlas,tatlas not found in /usr/local/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib
customize UnixCCompiler
libraries tatlas,tatlas not found in /usr/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib/
customize UnixCCompiler
libraries tatlas,tatlas not found in /usr/lib/
<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
NOT AVAILABLE
atlas_3_10_info:
customize UnixCCompiler
libraries lapack_atlas not found in /usr/local/lib
customize UnixCCompiler
libraries satlas,satlas not found in /usr/local/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib
customize UnixCCompiler
libraries satlas,satlas not found in /usr/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib/
customize UnixCCompiler
libraries satlas,satlas not found in /usr/lib/
<class 'numpy.distutils.system_info.atlas_3_10_info'>
NOT AVAILABLE
atlas_threads_info:
Setting PTATLAS=ATLAS
customize UnixCCompiler
libraries lapack_atlas not found in /usr/local/lib
customize UnixCCompiler
libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib
customize UnixCCompiler
libraries ptf77blas,ptcblas,atlas not found in /usr/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib/
customize UnixCCompiler
libraries ptf77blas,ptcblas,atlas not found in /usr/lib/
<class 'numpy.distutils.system_info.atlas_threads_info'>
NOT AVAILABLE
atlas_info:
customize UnixCCompiler
libraries lapack_atlas not found in /usr/local/lib
customize UnixCCompiler
libraries f77blas,cblas,atlas not found in /usr/local/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib
customize UnixCCompiler
libraries f77blas,cblas,atlas not found in /usr/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib/
customize UnixCCompiler
libraries f77blas,cblas,atlas not found in /usr/lib/
<class 'numpy.distutils.system_info.atlas_info'>
NOT AVAILABLE
accelerate_info:
NOT AVAILABLE
lapack_info:
customize UnixCCompiler
customize UnixCCompiler
FOUND:
libraries = ['lapack', 'lapack']
library_dirs = ['/usr/lib']
language = f77
blas_opt_info:
blas_mkl_info:
customize UnixCCompiler
libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
blis_info:
customize UnixCCompiler
libraries blis not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
openblas_info:
customize UnixCCompiler
customize UnixCCompiler
libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
atlas_3_10_blas_threads_info:
Setting PTATLAS=ATLAS
customize UnixCCompiler
libraries tatlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
atlas_3_10_blas_info:
customize UnixCCompiler
libraries satlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
atlas_blas_threads_info:
Setting PTATLAS=ATLAS
customize UnixCCompiler
libraries ptf77blas,ptcblas,atlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
atlas_blas_info:
customize UnixCCompiler
libraries f77blas,cblas,atlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
/tmp/pip-build-env-cbc8_kzr/overlay/lib/python3.8/site-packages/numpy/distutils/system_info.py:690: UserWarning:
Optimized (vendor) Blas libraries are not found.
Falls back to netlib Blas library which has worse performance.
A better performance should be easily gained by switching
Blas library.
self.calc_info()
blas_info:
customize UnixCCompiler
libraries blas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
/tmp/pip-build-env-cbc8_kzr/overlay/lib/python3.8/site-packages/numpy/distutils/system_info.py:690: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
self.calc_info()
blas_src_info:
NOT AVAILABLE
/tmp/pip-build-env-cbc8_kzr/overlay/lib/python3.8/site-packages/numpy/distutils/system_info.py:690: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
self.calc_info()
NOT AVAILABLE
/tmp/pip-build-env-cbc8_kzr/overlay/lib/python3.8/site-packages/numpy/distutils/system_info.py:1712: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
if getattr(self, '_calc_info_{}'.format(lapack))():
/tmp/pip-build-env-cbc8_kzr/overlay/lib/python3.8/site-packages/numpy/distutils/system_info.py:1712: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
if getattr(self, '_calc_info_{}'.format(lapack))():
FOUND:
libraries = ['lapack', 'lapack']
library_dirs = ['/usr/lib']
language = f77
define_macros = [('NO_ATLAS_INFO', 1)]
/tmp/pip-build-env-cbc8_kzr/overlay/lib/python3.8/site-packages/numpy/distutils/system_info.py:782: UserWarning: Specified path /tmp/pip-build-env-cbc8_kzr/overlay/include/python3.8 is invalid.
return self.get_paths(self.section, key)
scipy/odr/setup.py:19: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
warnings.warn(BlasNotFoundError.__doc__)
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/usr/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/tmp/pip-build-env-cbc8_kzr/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 166, in prepare_metadata_for_build_wheel
self.run_setup()
File "/tmp/pip-build-env-cbc8_kzr/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 258, in run_setup
super(_BuildMetaLegacyBackend,
File "/tmp/pip-build-env-cbc8_kzr/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 150, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 583, in <module>
setup_package()
File "setup.py", line 579, in setup_package
setup(**metadata)
File "/tmp/pip-build-env-cbc8_kzr/overlay/lib/python3.8/site-packages/numpy/distutils/core.py", line 137, in setup
config = configuration()
File "setup.py", line 485, in configuration
config.add_subpackage('scipy')
File "/tmp/pip-build-env-cbc8_kzr/overlay/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 1033, in add_subpackage
config_list = self.get_subpackage(subpackage_name, subpackage_path,
File "/tmp/pip-build-env-cbc8_kzr/overlay/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 999, in get_subpackage
config = self._get_configuration_from_setup_py(
File "/tmp/pip-build-env-cbc8_kzr/overlay/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 941, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "scipy/setup.py", line 17, in configuration
config.add_subpackage('odr')
File "/tmp/pip-build-env-cbc8_kzr/overlay/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 1033, in add_subpackage
config_list = self.get_subpackage(subpackage_name, subpackage_path,
File "/tmp/pip-build-env-cbc8_kzr/overlay/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 999, in get_subpackage
config = self._get_configuration_from_setup_py(
File "/tmp/pip-build-env-cbc8_kzr/overlay/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 941, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "scipy/odr/setup.py", line 28, in configuration
blas_info['define_macros'].extend(numpy_nodepr_api['define_macros'])
KeyError: 'define_macros'
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python /usr/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpvkfinqgv Check the logs for full command output.
WARNING: You are using pip version 20.3.1; however, version 21.1.2 is available.
You should consider upgrading via the '/usr/bin/python -m pip install --upgrade pip' command.
bash-5.0#
bash-5.0# apk add openblas-dev
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/aarch64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/aarch64/APKINDEX.tar.gz
(1/2) Installing openblas (0.3.9-r2)
(2/2) Installing openblas-dev (0.3.9-r2)
Executing glibc-bin-2.32-r0.trigger
/usr/glibc-compat/sbin/ldconfig: /usr/glibc-compat/lib/ld-linux-aarch64.so.1 is not a symbolic link
OK: 614 MiB in 121 packages
bash-5.0# pip install scipy
Collecting scipy
Downloading scipy-1.6.3.tar.gz (27.2 MB)
|████████████████████████████████| 27.2 MB 5.5 MB/s
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python /usr/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpi7v8cye1
cwd: /tmp/pip-install-hx4tjyta/scipy_85e0e5970b2d4f13913c09679a317a4f
Complete output (4 lines):
setup.py:462: UserWarning: Unrecognized setuptools command ('dist_info --egg-base /tmp/pip-modern-metadata-undac0lj'), proceeding with generating Cython sources and expanding templates
warnings.warn("Unrecognized setuptools command ('{}'), proceeding with "
Error: 'numpy' must be installed before running the build.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python /usr/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpi7v8cye1 Check the logs for full command output.
`
apk add openblas-dev=0.3.9-r2
should be added to Dockerfile (maybe there are more packages to add...)
https://unix.stackexchange.com/questions/550290/using-blas-in-alpine-linux
As work-arround one need to type
docker run -it --entrypoint bash alexberkovich/alpine-python3:0.3.2
or
docker run -it --entrypoint bash alexberkovich/alpine-anaconda3:0.3.2
The entrypoint should be sh/bash.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.