Unable to install in a virtualenv with pyenv
shun-liang opened this issue · comments
Dear maintainers, when I tried to install pip install python-mecab-ko
in a virtualenv with pyenv, I have received the following errors:
shun.liang@B-1170 ~/mecab-ko-test pyenv --version
pyenv 1.2.16
shun.liang@B-1170 ~/mecab-ko-test pyenv virtualenv 3.6.8 mecab-ko-test
Using base prefix '/Users/shun.liang/.pyenv/versions/3.6.8'
New python executable in /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/bin/python3.6
Also creating executable in /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/bin/python
Installing setuptools, pip, wheel...
done.
Looking in links: /var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp46dhgc65
Requirement already satisfied: setuptools in /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/lib/python3.6/site-packages (45.2.0)
Requirement already satisfied: pip in /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/lib/python3.6/site-packages (20.0.2)
shun.liang@B-1170 ~/mecab-ko-test pyenv activate mecab-ko-test
pyenv-virtualenv: prompt changing will be removed from future release. configure `export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
(mecab-ko-test) shun.liang@B-1170 ~/mecab-ko-test pip install python-mecab-ko
Looking in indexes: https://pypi.org/simple, <redacted>
Collecting python-mecab-ko
Using cached python-mecab-ko-1.0.8.tar.gz (6.7 kB)
Collecting pybind11~=2.0
Using cached pybind11-2.4.3-py2.py3-none-any.whl (150 kB)
Building wheels for collected packages: python-mecab-ko
Building wheel for python-mecab-ko (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py'"'"'; __file__='"'"'/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-wheel-qwpi5ati
cwd: /private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/
Complete output (66 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.13-x86_64-3.6
creating build/lib.macosx-10.13-x86_64-3.6/mecab
copying mecab/mecab.py -> build/lib.macosx-10.13-x86_64-3.6/mecab
copying mecab/__init__.py -> build/lib.macosx-10.13-x86_64-3.6/mecab
running build_ext
creating var
creating var/folders
creating var/folders/gj
creating var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr
creating var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/shun.liang/.pyenv/versions/3.6.8/include/python3.6m -c /var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp4ps69iwa.cpp -o var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp4ps69iwa.o -std=c++14
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/shun.liang/.pyenv/versions/3.6.8/include/python3.6m -c /var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp_8bky15n.cpp -o var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp_8bky15n.o -fvisibility=hidden
building '_mecab' extension
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py", line 178, in <module>
'build_ext': BuildExtensionCommand
File "/Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/lib/python3.6/site-packages/setuptools/__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 223, in run
self.run_command('build')
File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 87, in run
_build_ext.run(self)
File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/command/build_ext.py", line 339, in run
self.build_extensions()
File "/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py", line 42, in build_extensions
super().build_extensions()
File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "/Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 208, in build_extension
_build_ext.build_extension(self, ext)
File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension
depends=ext.depends)
File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/ccompiler.py", line 566, in compile
depends, extra_postargs)
File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/ccompiler.py", line 341, in _setup_compile
pp_opts = gen_preprocess_options(macros, incdirs)
File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/ccompiler.py", line 1075, in gen_preprocess_options
pp_opts.append("-I%s" % dir)
File "/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py", line 94, in __str__
return func(*self.args, **self.kwargs)
File "/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py", line 107, in get_pybind_include
import pybind11
ModuleNotFoundError: No module named 'pybind11'
----------------------------------------
ERROR: Failed building wheel for python-mecab-ko
Running setup.py clean for python-mecab-ko
Failed to build python-mecab-ko
Installing collected packages: pybind11, python-mecab-ko
Running setup.py install for python-mecab-ko ... error
ERROR: Command errored out with exit status 1:
command: /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py'"'"'; __file__='"'"'/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-record-z0z4pbay/install-record.txt --single-version-externally-managed --compile --install-headers /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/include/site/python3.6/python-mecab-ko
cwd: /private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/
Complete output (13 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.13-x86_64-3.6
creating build/lib.macosx-10.13-x86_64-3.6/mecab
copying mecab/mecab.py -> build/lib.macosx-10.13-x86_64-3.6/mecab
copying mecab/__init__.py -> build/lib.macosx-10.13-x86_64-3.6/mecab
running build_ext
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/shun.liang/.pyenv/versions/3.6.8/include/python3.6m -c /var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp424r_q5w.cpp -o var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp424r_q5w.o -std=c++14
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/shun.liang/.pyenv/versions/3.6.8/include/python3.6m -c /var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp2ymetpou.cpp -o var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp2ymetpou.o -fvisibility=hidden
building '_mecab' extension
error: [Errno 2] No such file or directory: '/Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/bin/mecab-config': '/Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/bin/mecab-config'
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py'"'"'; __file__='"'"'/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-record-z0z4pbay/install-record.txt --single-version-externally-managed --compile --install-headers /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/include/site/python3.6/python-mecab-ko Check the logs for full command output.
It seems there are two source of problems:
- During the installation, the dependency
pybind11
cannot be found. - The
install-mecab-ko.py
script tries to findmecab-config
undersys.config
'sbin
, but if Python is run within a virtualenv, thensys.prefix
won't be the default/user/local
.
Can I ask if you are able to advise? Many thanks.
Sorry for the late response.
First, I tried to install python-mecab-ko
on Ubuntu 18.04 in a virtual environment using pyenv
. In this case, I couldn't reproduce the same error as you.
On macOS, I created a virtual environment using native venv
module and tried to install python-mecab-ko
. Even in this case, I couldn't reproduce the error.
For your information, install-mecab-ko.py
script tries to find all executables under f'{sys.prefix}/bin'
, not /usr/local/bin
. Therefore, I think it is not a path problem as you mentioned.
Could you please try again and install python-mecab-ko
with -v
option?
pip install -v python-mecab-ko