Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to install Python Wrapper #23

Closed
huache opened this issue Sep 26, 2017 · 1 comment
Closed

Fail to install Python Wrapper #23

huache opened this issue Sep 26, 2017 · 1 comment

Comments

@huache
Copy link

huache commented Sep 26, 2017

When run pip install sentencepiece in python 3.6.1, I got this error:

  building '_sentencepiece' extension
  creating build/temp.linux-x86_64-3.6
  gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/yuchang/miniconda3/include/python3.6m -c sentencepiece_wrap.cxx -o build/temp.linux-x86_64-3.6/sentencepiece_wrap.o -std=c++11 -g -O2 -I/usr/local/include
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  sentencepiece_wrap.cxx: In function ‘PyObject* _wrap_SentencePieceProcessor_Load(PyObject*, PyObject*)’:
  sentencepiece_wrap.cxx:3305:53: error: ‘PyString_AsStringAndSize’ was not declared in this scope
         PyString_AsStringAndSize(obj1, &str, &str_size);
                                                       ^
  sentencepiece_wrap.cxx: In function ‘PyObject* _wrap_SentencePieceProcessor_LoadOrDie(PyObject*, PyObject*)’:
  sentencepiece_wrap.cxx:3347:53: error: ‘PyString_AsStringAndSize’ was not declared in this scope
         PyString_AsStringAndSize(obj1, &str, &str_size);
                                                       ^

I googled the "PyString_AsStringAndSize", some one said that it means the code does not support python3 , so I change the python version to 2.7.12, then I got:

Collecting sentencepiece
  Using cached sentencepiece-0.0.0.tar.gz
    Complete output from command python setup.py egg_info:
    Package sentencepiece was not found in the pkg-config search path.
    Perhaps you should add the directory containing `sentencepiece.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'sentencepiece' found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-joX_PJ/sentencepiece/setup.py", line 28, in <module>
        cmd('pkg-config sentencepiece --cflags'),
      File "/tmp/pip-build-joX_PJ/sentencepiece/setup.py", line 14, in cmd
        return os.popen(line).readlines()[0][:-1].split()
    IndexError: list index out of range
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-joX_PJ/sentencepiece/

My OS is Ubuntu 16.04, python 3.6.1 installed by miniconda3 , python 2.7.12 installed with system.

Any advise or guidance would be greatly appreciated.

@huache
Copy link
Author

huache commented Sep 29, 2017

My friend setup the python wrapper on Ubuntu 16.04 and python 2.7.12 successfully, so, it is certainly something wrong with my machine. But it is really wired.
Anyway, I should close this issue now, sorry to bother you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant