I got error while installing both contractions, pycontractions through terminal and settings on PyCharm. However I was able to install them on ubuntu command line. But it seems pycharm is not able to import packages installed through command line of ubuntu.
While installing the contraction, pycontraction package on PyCharm I got following error :
Collecting pycontractions
Downloading pycontractions-2.0.1-py3-none-any.whl (9.6 kB)
Collecting gensim>=2.0
Downloading gensim-4.1.2-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (24.1 MB)
Collecting pyemd>=0.4.4
Downloading pyemd-0.5.1.tar.gz (91 kB)
Collecting language-check>=1.0
Downloading language-check-1.1.tar.gz (33 kB)
Requirement already satisfied: scipy>=0.18.1 in /home/mike/PycharmProjects/sentiment-analysis/venv/lib/python3.7/site-packages (from gensim>=2.0->pycontractions) (1.7.1)
Requirement already satisfied: numpy>=1.17.0 in /home/mike/PycharmProjects/sentiment-analysis/venv/lib/python3.7/site-packages (from gensim>=2.0->pycontractions) (1.21.3)
Collecting smart-open>=1.8.1
Downloading smart_open-5.2.1-py3-none-any.whl (58 kB)
Building wheels for collected packages: language-check, pyemd
Building wheel for language-check (setup.py): started
Building wheel for language-check (setup.py): still running...
Building wheel for language-check (setup.py): finished with status 'error'
Running setup.py clean for language-check
Building wheel for pyemd (setup.py): started
Building wheel for pyemd (setup.py): finished with status 'error'
Running setup.py clean for pyemd
Failed to build language-check pyemd
Installing collected packages: smart-open, pyemd, language-check, gensim, pycontractions
Running setup.py install for pyemd: started
Running setup.py install for pyemd: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /home/mike/PycharmProjects/sentiment-analysis/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lxk5lfva/language-check_3eaf32c96573438f8c5b56e9f1c8c15c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lxk5lfva/language-check_3eaf32c96573438f8c5b56e9f1c8c15c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-8m60jjom
cwd: /tmp/pip-install-lxk5lfva/language-check_3eaf32c96573438f8c5b56e9f1c8c15c/
Complete output (35 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-lxk5lfva/language-check_3eaf32c96573438f8c5b56e9f1c8c15c/setup.py", line 595, in <module>
sys.exit(main())
File "/tmp/pip-install-lxk5lfva/language-check_3eaf32c96573438f8c5b56e9f1c8c15c/setup.py", line 590, in main
run_setup_hooks(config)
File "/tmp/pip-install-lxk5lfva/language-check_3eaf32c96573438f8c5b56e9f1c8c15c/setup.py", line 561, in run_setup_hooks
language_tool_hook(config)
File "/tmp/pip-install-lxk5lfva/language-check_3eaf32c96573438f8c5b56e9f1c8c15c/setup.py", line 584, in language_tool_hook
download_lt()
File "/tmp/pip-install-lxk5lfva/language-check_3eaf32c96573438f8c5b56e9f1c8c15c/download_lt.py", line 128, in download_lt
with closing(urlopen(url)) as u:
File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.7/urllib/request.py", line 531, in open
response = meth(req, response)
File "/usr/lib/python3.7/urllib/request.py", line 641, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.7/urllib/request.py", line 563, in error
result = self._call_chain(*args)
File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/lib/python3.7/urllib/request.py", line 755, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/usr/lib/python3.7/urllib/request.py", line 531, in open
response = meth(req, response)
File "/usr/lib/python3.7/urllib/request.py", line 641, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.7/urllib/request.py", line 569, in error
return self._call_chain(*args)
File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/lib/python3.7/urllib/request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
----------------------------------------
ERROR: Failed building wheel for language-check
ERROR: Command errored out with exit status 1:
command: /home/mike/PycharmProjects/sentiment-analysis/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lxk5lfva/pyemd_aa42532f0bbb45ce80073728273c4144/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lxk5lfva/pyemd_aa42532f0bbb45ce80073728273c4144/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-za_foj8v
cwd: /tmp/pip-install-lxk5lfva/pyemd_aa42532f0bbb45ce80073728273c4144/
Complete output (20 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/pyemd
copying pyemd/__about__.py -> build/lib.linux-x86_64-3.7/pyemd
copying pyemd/__init__.py -> build/lib.linux-x86_64-3.7/pyemd
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building 'pyemd.emd' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/pyemd
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/mike/PycharmProjects/sentiment-analysis/venv/include -I/usr/include/python3.7m -I/home/mike/PycharmProjects/sentiment-analysis/venv/lib/python3.7/site-packages/numpy/core/include -c pyemd/emd.cpp -o build/temp.linux-x86_64-3.7/pyemd/emd.o
pyemd/emd.cpp:23:10: fatal error: Python.h: No such file or directory
#include "Python.h"
^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pyemd
ERROR: Command errored out with exit status 1:
command: /home/mike/PycharmProjects/sentiment-analysis/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lxk5lfva/pyemd_aa42532f0bbb45ce80073728273c4144/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lxk5lfva/pyemd_aa42532f0bbb45ce80073728273c4144/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-l59ioki7/install-record.txt --single-version-externally-managed --compile --install-headers /home/mike/PycharmProjects/sentiment-analysis/venv/include/site/python3.7/pyemd
cwd: /tmp/pip-install-lxk5lfva/pyemd_aa42532f0bbb45ce80073728273c4144/
Complete output (20 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/pyemd
copying pyemd/__about__.py -> build/lib.linux-x86_64-3.7/pyemd
copying pyemd/__init__.py -> build/lib.linux-x86_64-3.7/pyemd
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building 'pyemd.emd' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/pyemd
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/mike/PycharmProjects/sentiment-analysis/venv/include -I/usr/include/python3.7m -I/home/mike/PycharmProjects/sentiment-analysis/venv/lib/python3.7/site-packages/numpy/core/include -c pyemd/emd.cpp -o build/temp.linux-x86_64-3.7/pyemd/emd.o
pyemd/emd.cpp:23:10: fatal error: Python.h: No such file or directory
#include "Python.h"
^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/mike/PycharmProjects/sentiment-analysis/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lxk5lfva/pyemd_aa42532f0bbb45ce80073728273c4144/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lxk5lfva/pyemd_aa42532f0bbb45ce80073728273c4144/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-l59ioki7/install-record.txt --single-version-externally-managed --compile --install-headers /home/mike/PycharmProjects/sentiment-analysis/venv/include/site/python3.7/pyemd Check the logs for full command output.
WARNING: You are using pip version 21.1.2; however, version 21.3.1 is available.
You should consider upgrading via the '/home/mike/PycharmProjects/sentiment-analysis/venv/bin/python -m pip install --upgrade pip' command.
A similar question is asked here however it's still unanswered.
I tried :
sudo apt-get install python3-dev
But it's already in the newest version and thus it's not the cause of my problem. Hence my problem is not duplicate of this.