maciejkula / glove-python

Toy Python implementation of http://www-nlp.stanford.edu/projects/glove/
Apache License 2.0
1.25k stars 319 forks source link

unable to install on Win 7 #42

Open chaltik opened 8 years ago

chaltik commented 8 years ago

whether using python setup.py install or pip install glove-python commands from Anaconda prompt, any installation attempt ends in failure with the error 2 below

c:\Anaconda>pip install glove-python
Collecting glove-python
  Downloading glove_python-0.1.0.tar.gz (263kB)
    100% |################################| 266kB 744kB/s
Requirement already satisfied (use --upgrade to upgrade): numpy in c:\anaconda\l
ib\site-packages (from glove-python)
Requirement already satisfied (use --upgrade to upgrade): scipy in c:\anaconda\l
ib\site-packages (from glove-python)
Building wheels for collected packages: glove-python
  Running setup.py bdist_wheel for glove-python ... error
  Complete output from command c:\anaconda\python.exe -u -c "import setuptools,
tokenize;__file__='c:\\users\\captain\\appdata\\local\\temp\\pip-build-jiom9g\\g
love-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).re
ad().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d c:\users\captain\
appdata\local\temp\tmpbo71fdpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-2.7
  creating build\lib.win-amd64-2.7\glove
  copying glove\corpus.py -> build\lib.win-amd64-2.7\glove
  copying glove\glove.py -> build\lib.win-amd64-2.7\glove
  copying glove\__init__.py -> build\lib.win-amd64-2.7\glove
  running build_ext

  building 'glove.glove_cython' extension
  error: [Error 2] The system cannot find the file specified
maciejkula commented 8 years ago

Can you try to find out which file it thinks it's missing?

chaltik commented 8 years ago

Sorry, I am not sure where to look for something like that, I am fairly new to Python, let alone to cython extensions. Seems like it happens shortly after the line building 'glove.glove_cython' extension is printed, but i could not find anything similar to this line using grep.

On Sun, Jan 31, 2016 at 12:53 PM, maciejkula notifications@github.com wrote:

Can you try to find out which file it think it's missing?

— Reply to this email directly or view it on GitHub https://github.com/maciejkula/glove-python/issues/42#issuecomment-177607712 .

maciejkula commented 8 years ago

OK. I'll try to reproduce when I get a bit of time.

chaltik commented 8 years ago

Thanks so much! Will wait for your results.

On Mon, Feb 1, 2016 at 2:44 PM, maciejkula notifications@github.com wrote:

OK. I'll try to reproduce when I get a bit of time.

— Reply to this email directly or view it on GitHub https://github.com/maciejkula/glove-python/issues/42#issuecomment-178237359 .

LopezGG commented 8 years ago

Is there a conda install for this ? I do have visual Studio 2015 with C++ installed. Here is the error I get

LINK : warning LNK4044: unrecognized option '/fopenmp'; ignored LINK : warning LNK4044: unrecognized option '/ffast-math'; ignored LINK : fatal error LNK1181: cannot open input file 'stdc++.lib' error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\link.exe' failed with exit status 1181

for python 3.5

hank-nguyen commented 8 years ago

@LopezGG: I have the same issue. Have you found out how to fix it? Thank you very much.

LopezGG commented 8 years ago

Nope. I did not figure it out. I used glove code compiled by a colleague. I suspect it has something to do with spaces in the path on windows OS

hank-nguyen commented 8 years ago

@LopezGG : thank you. I also decided to use GloVe on Ubuntu instead.

chaltik commented 8 years ago

That's the direction I have taken as well

On Thu, Apr 28, 2016 at 5:44 AM, Suinga notifications@github.com wrote:

@LopezGG https://github.com/LopezGG : thank you. I also decided to use GloVe on Ubuntu instead.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/maciejkula/glove-python/issues/42#issuecomment-215411959

elekesabel commented 8 years ago

same issue. is there any new solution for this?

huan086 commented 8 years ago

I removed stdc++ from setup.py and it compiled and worked

        Extension("glove.corpus_cython", [glove_corpus],
                  language='C++',
                  libraries=[],
                  extra_link_args=compile_args,
                  extra_compile_args=compile_args)]
oshribr commented 8 years ago

I removed stdc++ from setup.py and it compiled and worked

    Extension("glove.corpus_cython", [glove_corpus],
              language='C++',
              libraries=[],
              extra_link_args=compile_args,
              extra_compile_args=compile_args)]

Hi huam086, After you remove 'stdc++' and is installed it, the package works fine ?

Subinsm commented 7 years ago

Have you installed cython package. It is a prerequisite for installing glove-python.

oshribr commented 7 years ago

Have you installed cython package. It is a prerequisite for installing glove-python.

Hi Subinsm,

I'm using Anaconda, so yes I have Cython.

Subinsm commented 7 years ago

Hi Subinsm, I'm using Anaconda, so yes I have Cython.

Anaconda does not have cython pre-installed. You will have to install cython manually. In a terminal try, conda install cython Have numpy to the latest version to avoid warning messages

ConradSpiteri commented 7 years ago

Thanks @huan086, It worked for me.

prabhakar9885 commented 7 years ago

I am able to install the Glove by following comment of @huan086

Now, I am getting an ImportError


from glove import Glove
importerror: No module named corpus_cython

Any idea how to fix it?

rahul4tripathi2 commented 7 years ago

How to install glove-python in windows

  1. git clone https://github.com/maciejkula/glove-python.git
  2. goto cloned directory location and open setup.py and remove 'stdc++' from libraries=[] paramerter after removing it will look like below

    Extension("glove.corpus_cython", [glove_corpus], language='C++', libraries=[], extra_link_args=compile_args, extra_compile_args=compile_args)]

  3. conda install cython
  4. open cmd from that location where setup.py is stored and run below command python setup.py install
  5. Verify
    glove
JabeurSoufian commented 6 years ago

thank you for the tutorial How can I go to the clone directory(can you give the path)? to change setup.py configuration

IronFarm commented 6 years ago

@huan086 @prabhakar9885 @rahul4tripathi2 @JabeurSoufian

Deleting the dependency may allow you to compile and install the package but it won't work as expected. The dependency is there for a reason.

After many hours of tinkering I've managed to install this package on Windows and the tests pass for me. I documented my findings in this wiki page: https://github.com/maciejkula/glove-python/wiki/Installation-on-Windows

sakurakhadag commented 5 years ago

Thanks a lot. It worked

@huan086 @prabhakar9885 @rahul4tripathi2 @JabeurSoufian

Deleting the dependency may allow you to compile and install the package but it won't work as expected. The dependency is there for a reason.

After many hours of tinkering I've managed to install this package on Windows and the tests pass for me. I documented my findings in this wiki page: https://github.com/maciejkula/glove-python/wiki/Installation-on-Windows

AHAMES commented 5 years ago

I am having the same problems and when I try conda install cython I get this message

Preparing transaction: done
Verifying transaction: done
Executing transaction: failed
ERROR conda.core.link:_execute(507): An error occurred while installing package 'defaults::pyqt-4.10.4-py27_1'.
IOError(13, 'Permission denied')
Attempting to roll back.

Rolling back transaction: done

IOError(13, 'Permission denied')

And when I try to run setup install i get this too Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27

IronFarm commented 5 years ago

@AHAMES do you have sufficient permissions to install new conda packages? Do you have other python programs running (including Jupyter Notebooks) that could prevent an old version of the pyqt library being replaced?

AHAMES commented 5 years ago

@IronFarm Spyder was running and after I closed it it installed, but I am still getting Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27 When running Setup install

IronFarm commented 5 years ago

@AHAMES That's to be expected. Installing the package requires some C code to be compiled. One way of achieving this on Windows is to install Microsoft Visual C++ so I'd suggest installing the stated package.

I had most luck using an alternate compiler and python 3.6. I wrote up my installation procedure here: https://github.com/maciejkula/glove-python/wiki/Installation-on-Windows

AHAMES commented 5 years ago

@IronFarm I followed your guide, but it still doesn't install, pytest is not recognized. And I am getting this error while trying to import Glove.

Does you method work for python2.7 ?

>>> from glove import Glove
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "glove\__init__.py", line 1, in <module>
    from .corpus import Corpus
  File "glove\corpus.py", line 10, in <module>
    from .corpus_cython import construct_cooccurrence_matrix
ImportError: No module named corpus_cython
IronFarm commented 5 years ago

@AHAMES well it's not too surprising that you can't import it if it didn't install. What is the installation error?

I haven't tried python 2.7 but it might work. I'd strongly recommend upgrading in the near future though as python 2 support has already been dropped by many major packages e.g. scipy & numpy.

AHAMES commented 5 years ago

I re-tracked my steps and found this when running pip install .

C:\Users\X\Documents\NetBeansProjects\MedHelpCrawler_1\glove-python>pip install .
Processing c:\users\ahmed\documents\netbeansprojects\medhelpcrawler_1\glove-python
Requirement already satisfied: numpy in c:\python27\lib\site-packages (from glove-python==0.1.0) (1.14.3)
Requirement already satisfied: scipy in c:\python27\lib\site-packages (from glove-python==0.1.0) (1.1.0)
Installing collected packages: glove-python
  Found existing installation: glove-python 0.1.0
    Uninstalling glove-python-0.1.0:
      Successfully uninstalled glove-python-0.1.0
  Running setup.py install for glove-python ... done
Successfully installed glove-python-0.1.0
c:\python27\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py:369: SNIMissingWarning: An HTTPS request has been made, but the SNI (Server Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  SNIMissingWarning
c:\python27\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py:160: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError(1, '_ssl.c:507: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)) - skipping
IronFarm commented 5 years ago

@AHAMES It suggests it successfully installed Glove before the error (the error suggests upgrading python FWIW).

Did you by any chance follow the steps in this comment? They allow the package to install but they completely break the package's functionality: https://github.com/maciejkula/glove-python/issues/42#issuecomment-325650191

AHAMES commented 5 years ago

@IronFarm I did actually follow them at first, you think it will work if i reverse it? Will try it.

IronFarm commented 5 years ago

@AHAMES You may have problems with the compilation and installation but when it installs it will actually work.

AHAMES commented 5 years ago

@IronFarm (I restarted from the beginning and got a python 3.6 virtual env, but for some reason it still runs on 2.7 when using pytest and it doesn't import when running python) scratch that, it does import in python 3.6 when running python itself. Thank you for your effort with me and thank you for your patience.

(glove) C:\Users\Ahmed\Documents\NetBeansProjects\glove-python>pytest
============================= test session starts =============================
platform win32 -- Python 2.7.15, pytest-3.8.0, py-1.6.0, pluggy-0.7.1
rootdir: C:\Users\Ahmed\Documents\NetBeansProjects\glove-python, inifile:
collected 0 items / 2 errors

=================================== ERRORS ====================================
____________________ ERROR collecting tests/test_corpus.py ____________________
ImportError while importing test module 'C:\Users\Ahmed\Documents\NetBeansProjects\glove-python\tests\test_corpus.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
..\..\..\Anaconda2\lib\site-packages\six.py:709: in exec_
    exec("""exec _code_ in _globs_, _locs_""")
tests\test_corpus.py:9: in <module>
    from glove import Corpus
E   ImportError: No module named glove
____________________ ERROR collecting tests/test_glove.py _____________________
ImportError while importing test module 'C:\Users\Ahmed\Documents\NetBeansProjects\glove-python\tests\test_glove.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
..\..\..\Anaconda2\lib\site-packages\six.py:709: in exec_
    exec("""exec _code_ in _globs_, _locs_""")
tests\test_glove.py:4: in <module>
    from glove import Corpus, Glove
E   ImportError: No module named glove
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!
=========================== 2 error in 0.41 seconds ===========================
IronFarm commented 5 years ago

So is it working now? You probably need to install pytest in your python 3 virtual env for the tests to work. However, if the module is behaving as expected there is no need to run the tests.

beiyaoovo commented 8 months ago

I removed stdc++ from setup.py and it compiled and worked

        Extension("glove.corpus_cython", [glove_corpus],
                  language='C++',
                  libraries=[],
                  extra_link_args=compile_args,
                  extra_compile_args=compile_args)]

You are my God! I spent a whole afternoon!