question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

in2csv: "ImportWarning: can't resolve package from __spec__ or __package__"

See original GitHub issue

After installing csvkit using pip (under 4.14.9-2-MANJARO Linux with Python 3.6.4), and running in2csv, I got a bunch of warnings like these:

$ in2csv
/usr/lib/python3.6/importlib/_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
/usr/lib/python3.6/importlib/_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
/usr/lib/python3.6/importlib/_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
... [about 20 of the same omitted]
/usr/lib/python3.6/importlib/_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
usage: in2csv [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b]
              [-p ESCAPECHAR] [-z FIELD_SIZE_LIMIT] [-e ENCODING] [-L LOCALE]
              [-S] [--blanks] [--date-format DATE_FORMAT]
              [--datetime-format DATETIME_FORMAT] [-H] [-K SKIP_LINES] [-v]
              [-l] [--zero] [-V] [-f FILETYPE] [-s SCHEMA] [-k KEY] [-n]
              [--sheet SHEET] [--write-sheets WRITE_SHEETS] [-y SNIFF_LIMIT]
              [-I]
              [FILE]

The script works (when provided a file), but generates these warnings every time.

Environment:

$ pip freeze
agate==1.6.0
agate-dbf==0.2.0
agate-excel==0.2.1
agate-sql==0.5.2
appdirs==1.4.3
awscli==1.14.26
Babel==2.5.3
Beaker==1.8.1
beautifulsoup4==4.6.0
bigml==4.14.0
bigmler==3.16.0
bleach==2.1.1
botocore==1.8.32
catfish==1.4.2
certifi==2018.1.18
chardet==3.0.4
colorama==0.3.9
csvkit==1.0.2
cycler==0.10.0
dbfread==2.0.7
decorator==4.2.1
docopt==0.6.2
docutils==0.14
entrypoints==0.2.3
et-xmlfile==1.0.1
future==0.16.0
gufw==17.10.0
html5lib==1.0b10
idna==2.6
ipykernel==4.6.1
ipython==6.2.1
ipython-genutils==0.2.0
ipywidgets==6.0.0
isodate==0.6.0
jdcal==1.3
jedi==0.11.1
Jinja2==2.10
jmespath==0.9.3
joblib==0.11
jsonschema==2.6.0
jupyter-client==5.1.0
jupyter-console==5.2.0
jupyter-contrib-core==0.3.3
jupyter-contrib-nbextensions==0.3.3
jupyter-core==4.4.0
jupyter-highlight-selected-word==0.1.0
jupyter-latex-envs==1.4.0
jupyter-nbextensions-configurator==0.2.8
keyutils==0.5
leather==0.3.3
lightdm-gtk-greeter-settings==1.2.2
louis==3.4.0
lxml==4.1.1
Mako==1.0.7
MarkupSafe==1.0
matplotlib==2.1.0
menulibre==2.1.3
mistune==0.8.3
mugshot==0.3.2
nbconvert==5.3.1
nbformat==4.4.0
notebook==5.2.2
npyscreen==4.10.5
numpy==1.13.3
olefile==0.44
openpyxl==2.5.0
packaging==16.8
pacman-mirrors==4.7.0
pandas==0.21.0
pandocfilters==1.4.2
parsedatetime==2.4
parso==0.1.1
pexpect==4.3.0
pickleshare==0.7.4
Pillow==4.3.0
prettytable==0.7.2
prompt-toolkit==1.0.15
psutil==5.4.1
ptyprocess==0.5.2
pyasn1==0.4.2
pycairo==1.15.4
Pygments==2.2.0
pygobject==3.26.1
pyparsing==2.2.0
python-dateutil==2.6.1
python-distutils-extra==2.39
python-sane==2.8.3
python-slugify==1.2.4
pytimeparse==1.1.7
pytz==2017.3
pyxdg==0.25
PyYAML==3.12
pyzmq==16.0.3
reportlab==3.4.0
requests==2.18.4
requests-toolbelt==0.8.0
rsa==3.4.2
ruamel.yaml==0.15.35
s3transfer==0.1.12
scikit-learn==0.19.1
scipy==1.0.0
simplegeneric==0.8.1
six==1.11.0
skll==1.5
SQLAlchemy==1.2.2
team==1.0
terminado==0.8.1
testpath==0.3.1
tornado==4.5.2
traitlets==4.3.2
udiskie==1.7.3
Unidecode==1.0.22
urllib3==1.22
virtualenv==15.1.0
wcwidth==0.1.7
webencodings==0.5.1
widgetsnbextension==2.0.0
xlrd==1.1.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
jpmckinneycommented, Jan 29, 2018

Hmm, I see that openpyxl imports pandas if available, and the warnings seem to be caused by pandas / Cython, as mentioned in this issue: https://github.com/cython/cython/issues/1720

So, I don’t think csvkit can do anything about it. You can create a virtual environment in which only csvkit is installed, without pandas, to avoid the warnings. Or wait for pandas/Cython to fix the warnings.

1reaction
Masterxilocommented, Nov 15, 2018

I had the same issue and used in2csv as follows to fix it:

function in2csvNOWARN {
	python3 -W ignore /usr/local/bin/in2csv "$@"
}

in2csvNOWARN my-parameters-...
Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportWarning: can't resolve package from __spec ... - Reddit
when I run my code, I get this warning: /home/muhammadmehdi/anaconda3/envs/memex/lib/python3.7/importlib/_bootstrap.py:219: ImportWarning: ...
Read more >
Developers - _bootstrap.py:219: ImportWarning: can't resolve ...
_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ ... Now when I just run in2csv from the windows command line I get a ...
Read more >
How To Resolve "Importwarning: Can't Resolve Package ... - ADocLib
Python 3.7.0 in2csv 1.0.3. Each time I run in2csv i get the following output warning: ImportWarning: can't resolve package from spec or.
Read more >
How to resolve "ImportWarning: can't resolve package from ...
Too my knowledge it is an eclipse / pydev issue related to changes in the import system of python. Just google the message...
Read more >
Bug #1732505 “ImportWarning: can't resolve package from ...
Importing lxml.etree produces an ImportWarning on Python 3.6. ... ImportWarning: can't resolve package from __spec__ or __package__, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found