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

TypeError: an integer is required #4975

Closed
MartinThoma opened this issue Feb 6, 2020 · 8 comments · Fixed by #4976
Closed

TypeError: an integer is required #4975

MartinThoma opened this issue Feb 6, 2020 · 8 comments · Fixed by #4976
Labels
install Installation issues

Comments

@MartinThoma
Copy link

How to reproduce the behaviour

$ python3.8 -m spacy info --markdown 
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.8/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.8/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/home/math/.local/lib/python3.8/site-packages/spacy/__init__.py", line 10, in <module>
    from thinc.neural.util import prefer_gpu, require_gpu
  File "/home/math/.local/lib/python3.8/site-packages/thinc/neural/__init__.py", line 4, in <module>
    from ._classes.model import Model  # noqa: F401
  File "/home/math/.local/lib/python3.8/site-packages/thinc/neural/_classes/model.py", line 7, in <module>
    import srsly
  File "/home/math/.local/lib/python3.8/site-packages/srsly/__init__.py", line 7, in <module>
    from ._pickle_api import pickle_dumps, pickle_loads
  File "/home/math/.local/lib/python3.8/site-packages/srsly/_pickle_api.py", line 4, in <module>
    from . import cloudpickle
  File "/home/math/.local/lib/python3.8/site-packages/srsly/cloudpickle/__init__.py", line 1, in <module>
    from .cloudpickle import *
  File "/home/math/.local/lib/python3.8/site-packages/srsly/cloudpickle/cloudpickle.py", line 167, in <module>
    _cell_set_template_code = _make_cell_set_template_code()
  File "/home/math/.local/lib/python3.8/site-packages/srsly/cloudpickle/cloudpickle.py", line 148, in _make_cell_set_template_code
    return types.CodeType(
TypeError: an integer is required (got type bytes)
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.8/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.8/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/home/math/.local/lib/python3.8/site-packages/spacy/__init__.py", line 10, in <module>
    from thinc.neural.util import prefer_gpu, require_gpu
  File "/home/math/.local/lib/python3.8/site-packages/thinc/neural/__init__.py", line 4, in <module>
    from ._classes.model import Model  # noqa: F401
  File "/home/math/.local/lib/python3.8/site-packages/thinc/neural/_classes/model.py", line 7, in <module>
    import srsly
  File "/home/math/.local/lib/python3.8/site-packages/srsly/__init__.py", line 7, in <module>
    from ._pickle_api import pickle_dumps, pickle_loads
  File "/home/math/.local/lib/python3.8/site-packages/srsly/_pickle_api.py", line 4, in <module>
    from . import cloudpickle
  File "/home/math/.local/lib/python3.8/site-packages/srsly/cloudpickle/__init__.py", line 1, in <module>
    from .cloudpickle import *
  File "/home/math/.local/lib/python3.8/site-packages/srsly/cloudpickle/cloudpickle.py", line 167, in <module>
    _cell_set_template_code = _make_cell_set_template_code()
  File "/home/math/.local/lib/python3.8/site-packages/srsly/cloudpickle/cloudpickle.py", line 148, in _make_cell_set_template_code
    return types.CodeType(
TypeError: an integer is required (got type bytes)

Your Environment

  • Operating System: Ubuntu 18.04
  • Python Version Used: 3.8.0
  • spaCy Version Used: 2.2.3
  • Environment Information:
$ python3.8 -m pip freeze
appdirs==1.4.3
apturl==0.5.2
asn1crypto==1.3.0
astroid==2.3.3
attrs==19.3.0
aws-sam-translator==1.20.1
aws-xray-sdk==2.4.3
azure-common==1.1.24
azure-storage-blob==2.1.0
azure-storage-common==2.1.0
bidict==0.18.0
black==19.10b0
blis==0.4.1
boto==2.49.0
boto3==1.9.190
boto3-type-annotations==0.3.1
botocore==1.12.190
Brlapi==0.6.6
catalogue==1.0.0
certifi==2019.6.16
cffi==1.13.2
cfn-lint==0.27.4
chardet==3.0.4
Click==7.0
cloudpickle==1.2.2
colorama==0.4.1
command-not-found==0.3
coverage==4.5.4
cryptography==2.8
cupshelpers==1.0
cymem==2.0.2
Cython==0.29.14
de-core-news-sm==2.2.5
decorator==4.1.2
defer==1.0.6
distro-info===0.18ubuntu0.18.04.1
docker==4.1.0
docutils==0.14
ecdsa==0.15
entrypoints==0.3
flake8==3.7.9
fsspec==0.3.3
future==0.18.2
h5py==2.9.0
httplib2==0.9.2
idna==2.8
ijson==2.6.1
implicit==0.3.9
isort==4.3.21
Jinja2==2.11.1
jmespath==0.9.4
joblib==0.14.1
jsondiff==1.1.2
jsonpatch==1.25
jsonpickle==1.2
jsonpointer==2.0
jsonschema==3.2.0
keyring==10.6.0
keyrings.alt==3.0
language-selector==0.1
launchpadlib==1.10.6
lazr.restfulclient==0.13.5
lazr.uri==1.0.3
lazy-object-proxy==1.4.3
louis==3.5.0
Mako==1.0.7
MarkupSafe==1.0
mate-hud==18.4.8
mate-tweak==18.4.16
mccabe==0.6.1
meld==3.18.0
mock==4.0.0
more-itertools==8.2.0
moto==1.3.14
mpu==0.19.0
murmurhash==1.0.2
mypy==0.761
mypy-extensions==0.4.3
netifaces==0.10.4
nltk==3.4.4
numpy==1.16.4
oauth==1.0.1
olefile==0.45.1
onboard==1.4.1
oscrypto==1.2.0
packaging==20.1
pandas==0.25.1
pathspec==0.7.0
pexpect==4.2.1
Pillow==5.1.0
pip-tools==4.4.1
plac==0.9.6
pluggy==0.13.1
preshed==3.0.2
psutil==5.4.2
py==1.8.1
pyasn1==0.4.8
pycairo==1.16.2
pycodestyle==2.5.0
pycparser==2.19
pycrypto==2.6.1
pycryptodomex==3.9.6
pycups==1.9.73
pydantic==1.4
pyflakes==2.1.1
pygobject==3.26.1
PyJWT==1.7.1
pylint==2.4.4
pyOpenSSL==19.1.0
pyparsing==2.4.6
pyrsistent==0.15.7
pytest==5.3.5
pytest-black==0.3.8
pytest-cov==2.8.1
pytest-flake8==1.0.4
pytest-mccabe==1.0
pytest-mock==2.0.0
python-apt==1.6.5+ubuntu0.2
python-dateutil==2.8.0
python-debian==0.1.32
python-jose==3.1.0
python-json-logger==0.1.11
python-xapp==1.0.0
python-xlib==0.20
pytz==2019.1
pyxdg==0.25
PyYAML==5.1.1
regex==2020.1.8
reportlab==3.4.0
requests==2.22.0
requests-unixsocket==0.1.5
responses==0.10.9
rsa==4.0
s3fs==0.3.0
s3transfer==0.2.1
scikit-learn==0.21.2
scipy==1.4.1
SecretStorage==2.3.1
sessioninstaller==0.0.0
setproctitle==1.1.10
simplejson==3.13.2
six==1.12.0
spacy==2.2.3
SQLAlchemy==1.3.13
srsly==0.1.0
sshpubkeys==3.1.0
structlog==19.1.0
systemd-python==234
thinc==7.3.1
toml==0.10.0
tqdm==4.32.2
typed-ast==1.4.1
typing-extensions==3.7.4.1
ubuntu-drivers-common==0.0.0
ufw==0.36
unattended-upgrades==0.1
urllib3==1.25.3
usb-creator==0.3.3
wadllib==1.3.2
wasabi==0.6.0
wcwidth==0.1.8
websocket-client==0.57.0
Werkzeug==0.16.1
wrapt==1.11.2
xkit==0.0.0
xmltodict==0.12.0
zope.interface==4.3.2
@MartinThoma
Copy link
Author

See #2545

@MartinThoma
Copy link
Author

See #3305

@MartinThoma
Copy link
Author

@adrianeboyd
Copy link
Contributor

As I can see you figured out (the links to spacy issues about integers aren't revelant), you just need to upgrade srsly.

@MartinThoma
Copy link
Author

@adrianeboyd I think you're a bit quick with closing this issue. I did have a version of srsly which was ok according to https:/explosion/spaCy/blob/master/setup.cfg#L50 - so maybe the setup.py needs to be updated?

@adrianeboyd
Copy link
Contributor

Thanks, you're right! That should have been updated with the release of v0.2.0 for srsly that fixed the cloudpickle problem, and I think currently it should probably be updated to v1.0.1.

@adrianeboyd adrianeboyd reopened this Feb 6, 2020
@svlandeg svlandeg added the install Installation issues label Feb 6, 2020
@MartinThoma
Copy link
Author

Awesome! Thanks for having another look at it and fixing it :-)

@lock
Copy link

lock bot commented Mar 12, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Mar 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
install Installation issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants