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

No module named 'fcntl' on windows7 #19

Closed
DanteOnline opened this issue Nov 16, 2017 · 15 comments
Closed

No module named 'fcntl' on windows7 #19

DanteOnline opened this issue Nov 16, 2017 · 15 comments

Comments

@DanteOnline
Copy link

pip install pymystem3 (python 3.6.2)

text = 'мама маму' m = Mystem() result = m.lemmatize(text)

error No module named 'fcntl'

@alexanderpanchenko
Copy link
Contributor

alexanderpanchenko commented Nov 17, 2017

I do not have access to a window box at the moment (and the Travis CI only builds for Linux and Mac OSX). However, it seems that the library was used by Windows users (but AFAIK of Windows 8+). Maybe (just a guess) on Windows 8+ this issue is solved somehow...

This is a non-trivial issue to solve: One needs to use Win32 API instead of fcntl syscalls:
https://stackoverflow.com/questions/1422368/fcntl-substitute-on-windows

If you can contribute the solution to this problem implementing for windows the workaround using the native Win32 API calls, such a pull request is highly welcome.

@peter-pogorelov
Copy link

peter-pogorelov commented Nov 17, 2017

The same issue. Suppuse that this problem came with a new update, because I can successfuly use the older version of pymystem3 (replaced code of "mystem.py" from last version to older one).

@alexanderpanchenko
Copy link
Contributor

alexanderpanchenko commented Nov 17, 2017 via email

@alexanderpanchenko
Copy link
Contributor

alexanderpanchenko commented Nov 17, 2017

i reverted the change which was seemingly caused the problem (i have no windows box, so cannot test it). can you try to install the new version of the package from pip?

@peter-pogorelov
Copy link

peter-pogorelov commented Nov 21, 2017

Thanks! But it would be nice to avoid usage python version-specific libraries too (replace ifilter -> filter, imap -> map).

>>> import pymystem3 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\LoadAdmin\Desktop\pymystem3-master\pymystem3\__init__.py", line 12, in <module> from .mystem import (Mystem, autoinstall) # noqa File "C:\Users\LoadAdmin\Desktop\pymystem3-master\pymystem3\mystem.py", line 8 , in <module> from itertools import ifilter, imap ImportError: cannot import name 'ifilter'

Function "unicode" is also supported only in python2.7, so replacing to "str".
_NL = unicode('\n').encode('utf-8') NameError: name 'unicode' is not defined

Method "iteritems" of "dict" object was replaced to "items" in python3.
for k, v in kvs.iteritems(): AttributeError: 'dict' object has no attribute 'iteritems'

"basestring" -> "str"
if isinstance(url, basestring): NameError: name 'basestring' is not defined

And now it is working!
import pymystem3
pymystem3.Mystem().analyze('1 2 3')
[{'text': '1'}, {'text': ' '}, {'text': '2'}, {'text': ' '}, {'text': '3'}, {'te xt': '\n'}]

PS. Sorry if I do something wrong, I simply clone master branch and run "pip install ." :)
Python version: Python 3.6.3
OS: Win7

@alexanderpanchenko
Copy link
Contributor

alexanderpanchenko commented Nov 21, 2017 via email

@peter-pogorelov
Copy link

Win7

@alexanderpanchenko
Copy link
Contributor

Can you please write if the same is observed on Windows 8+ or this is Windows 7 specific?

@eugenso
Copy link

eugenso commented Nov 22, 2017

I was able to install pymstem3 on a Windows 10 machine, running a fresh Python 3.6.3 installation. So maybe this is really Win 7 related.

@alexanderpanchenko
Copy link
Contributor

alexanderpanchenko commented Nov 22, 2017 via email

@eugenso
Copy link

eugenso commented Nov 22, 2017

Seems to work fine, exactly the same output as in the README:

from pymystem3 import Mystem
text = "Красивая мама красиво мыла раму"
m = Mystem()
lemmas = m.lemmatize(text)
print (''.join(lemmas))
красивый мама красиво мыть рама

@alexanderpanchenko
Copy link
Contributor

alexanderpanchenko commented Nov 22, 2017 via email

@alexanderpanchenko
Copy link
Contributor

Hello,

Due to the lack of a Windows 7 machine and the fact that the issue seems to be Windows 7 specific I cannot deliver a fix. You are however welcome to proivde a pull request which fixes the problems on Windows 7. We may have a separate release / branch / package which supports Windows 7.

@DanteOnline
Copy link
Author

Hello,

Sorry, was busy.
Problem on windows 7.
I can use ubuntu. There works fine.

@alexanderpanchenko
Copy link
Contributor

I will close this issue for now.

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

No branches or pull requests

4 participants