using pipreqs getting unknown error while to create requirements.txt - django

pipreqs .\
the following error is comming. i searched on the google i didn't find any solution.
ERROR: Failed on file: .\static\bower_components\jvectormap\converter\converter.py
Traceback (most recent call last):
File "C:\Users\bsant\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\bsant\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Users\bsant\Pictures\lms_m16\venv\Scripts\pipreqs.exe_main.py", line 7, in
File "C:\Users\bsant\Pictures\lms_m16\venv\lib\site-packages\pipreqs\pipreqs.py", line 488, in main
init(args)
File "C:\Users\bsant\Pictures\lms_m16\venv\lib\site-packages\pipreqs\pipreqs.py", line 415, in init
candidates = get_all_imports(input_path,
File "C:\Users\bsant\Pictures\lms_m16\venv\lib\site-packages\pipreqs\pipreqs.py", line 131, in get_all_imports
raise exc
File "C:\Users\bsant\Pictures\lms_m16\venv\lib\site-packages\pipreqs\pipreqs.py", line 117, in get_all_imports
tree = ast.parse(contents)
File "C:\Users\bsant\AppData\Local\Programs\Python\Python310\lib\ast.py", line 50, in parse
return compile(source, filename, mode, flags,
File "", line 139
raise Exception, "Wrong geometry type: "+geometryType
^
SyntaxError: invalid syntax

Related

Can't compile cython program using pyximport in Mac M1

I'm trying to use Cython (Cython version 0.29.30) to speed up my computations in Mac M1, and testing the .pyx by pyximport, but I got:
/Users/xxxx/.pyxbld/temp.macosx-10.9-universal2-3.10/pyrex/binomial.c:697:10: fatal error: 'ios' file not found
#include "ios"
^~~~~
1 error generated.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/unixccompiler.py", line 117, in _compile
self.spawn(compiler_so + cc_args + [src, '-o', obj] +
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/ccompiler.py", line 910, in spawn
spawn(cmd, dry_run=self.dry_run)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/spawn.py", line 91, in spawn
raise DistutilsExecError(
distutils.errors.DistutilsExecError: command '/usr/bin/clang' failed with exit code 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/pyximport.py", line 214, in load_module
so_path = build_module(module_name, pyxfilename, pyxbuild_dir,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/pyximport.py", line 186, in build_module
so_path = pyxbuild.pyx_to_dll(pyxfilename, extension_mod,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/pyxbuild.py", line 102, in pyx_to_dll
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
_build_ext.build_ext.build_extensions(self)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/command/build_ext.py", line 529, in build_extension
objects = self.compiler.compile(sources,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/unixccompiler.py", line 120, in _compile
raise CompileError(msg)
distutils.errors.CompileError: command '/usr/bin/clang' failed with exit code 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/pyximport.py", line 459, in load_module
module = load_module(fullname, self.path,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/pyximport.py", line 231, in load_module
raise exc.with_traceback(tb)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/pyximport.py", line 214, in load_module
so_path = build_module(module_name, pyxfilename, pyxbuild_dir,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/pyximport.py", line 186, in build_module
so_path = pyxbuild.pyx_to_dll(pyxfilename, extension_mod,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/pyxbuild.py", line 102, in pyx_to_dll
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
_build_ext.build_ext.build_extensions(self)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/command/build_ext.py", line 529, in build_extension
objects = self.compiler.compile(sources,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/unixccompiler.py", line 120, in _compile
raise CompileError(msg)
ImportError: Building module binomial failed: ["distutils.errors.CompileError: command '/usr/bin/clang' failed with exit code 1\n"]
I'm quite new in Cython. When I ran cython xxx.pyx directly, it worked. The answers in this question are great help, but I was confused and sought for a better solution. I tried the first answer that tried to use C++ compiler:
>>> script_args = ["--cython-cplus"]
>>> setup_args = {"script_args": script_args}
>>> pyximport.install(setup_args=setup_args, language_level=3)
but got:
distutils.errors.DistutilsExecError: command '/usr/bin/clang++' failed with exit code 1
So I tried the second answer. It works fine. This means that I have to create a .pyxbld file for each .pyx file, which is quite annoying.
How can I solve this?

TypeError in py36compat

I get this strange error on Python2.7. It works fine with Python3:
Traceback (most recent call last):
File "/home/guettli/descript/projects/descript_jugendhaus/.tox/py27-django14/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/home/guettli/descript/projects/descript_jugendhaus/.tox/py27-django14/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/guettli/descript/projects/descript_jugendhaus/.tox/py27-django14/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 156, in prepare_metadata_for_build_wheel
self.run_setup()
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 243, in run_setup
self).run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 142, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 195, in <module>
distclass=BinaryDistribution,
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/__init__.py", line 162, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/command/dist_info.py", line 31, in run
egg_info.run()
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 296, in run
self.find_sources()
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 303, in find_sources
mm.run()
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 534, in run
self.add_defaults()
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 570, in add_defaults
sdist.add_defaults(self)
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/command/py36compat.py", line 36, in add_defaults
self._add_defaults_ext()
File "/tmp/pip-build-env-sy2MSY/overlay/lib/python2.7/site-packages/setuptools/command/py36compat.py", line 118, in _add_defaults_ext
if self.distribution.has_ext_modules():
File "setup.py", line 109, in has_ext_modules
return super().has_ext_modules() or 'SETUPPY_ALLOW_PURE' not in os.environ
TypeError: super() takes at least 1 argument (0 given)
What could be the root-cause?
I found a solution.
If I disable the python-hunter library it works.
I guess python-hunter is not compatible with Python2.7 any more.
That's fine for my use case. I this case I can remove the library (although it is a great tracing library).

How to resolve an error message when attempting to start Jupyter-Notebook?

I have Jupyter-Notebook on an AWS EC2 instance. It was working fine until I made a few changes/updates and now I'm getting the following error message when I attempt to use Jupyter-Notebook:
ubuntu#ip-10-0-0-5:~$ jupyter-notebook
[E 06:41:09.375 NotebookApp] Exception while loading config file /home/ubuntu/.jupyter/jupyter_notebook_config.json
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python2.7/site-packages/traitlets/config/application.py", line 562, in _load_config_files
config = loader.load_config()
File "/home/ubuntu/.local/lib/python2.7/site-packages/traitlets/config/loader.py", line 406, in load_config
dct = self._read_file_as_dict()
File "/home/ubuntu/.local/lib/python2.7/site-packages/traitlets/config/loader.py", line 412, in _read_file_as_dict
return json.load(f)
File "/usr/lib/python2.7/json/__init__.py", line 291, in load
**kw)
File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 367, in decode
raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 17 column 1 - line 18 column 1 (char 255 - 257)
Traceback (most recent call last):
File "/home/ubuntu/.local/bin/jupyter-notebook", line 10, in <module>
sys.exit(main())
File "/home/ubuntu/.local/lib/python2.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/ubuntu/.local/lib/python2.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/home/ubuntu/.local/lib/python2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/home/ubuntu/.local/lib/python2.7/site-packages/notebook/notebookapp.py", line 1633, in initialize
self.init_server_extensions()
File "/home/ubuntu/.local/lib/python2.7/site-packages/notebook/notebookapp.py", line 1559, in init_server_extensions
section = manager.get(self.config_file_name)
File "/home/ubuntu/.local/lib/python2.7/site-packages/notebook/services/config/manager.py", line 25, in get
recursive_update(config, cm.get(section_name))
File "/home/ubuntu/.local/lib/python2.7/site-packages/notebook/config_manager.py", line 103, in get
recursive_update(data, json.load(f))
File "/usr/lib/python2.7/json/__init__.py", line 291, in load
**kw)
File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 367, in decode
raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 17 column 1 - line 18 column 1 (char 255 - 257)
Can anyone help me troubleshoot this problem?

exceptions.TypeError: __init__() got an unexpected keyword argument 'settings'

I have downloaded the distribute-crawler from github. But I found that didn't work. It is giving:
unexpected keyword argument 'settings'
Anybody know this?
The full stack trace is as follows:
2017-03-31 15:43:43 [twisted] ERROR: Unhandled error in Deferred:
2017-03-31 15:43:43 [twisted] ERROR: Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/scrapy/commands/crawl.py", line 57, in run
self.crawler_process.crawl(spname, **opts.spargs)
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 163, in crawl
return self._crawl(crawler, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 167, in _crawl
d = crawler.crawl(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1237, in unwindGenerator
return _inlineCallbacks(None, gen, Deferred())
--- <exception caught here> ---
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1099, in _inlineCallbacks
result = g.send(result)
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 90, in crawl
six.reraise(*exc_info)
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 72, in crawl
self.engine = self._create_engine()
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 97, in _create_engine
return ExecutionEngine(self, lambda _: self.stop())
File "/usr/local/lib/python2.7/dist-packages/scrapy/core/engine.py", line 70, in __init__
self.scraper = Scraper(crawler)
File "/usr/local/lib/python2.7/dist-packages/scrapy/core/scraper.py", line 71, in __init__
self.itemproc = itemproc_cls.from_crawler(crawler)
File "/usr/local/lib/python2.7/dist-packages/scrapy/middleware.py", line 58, in from_crawler
return cls.from_settings(crawler.settings, crawler)
File "/usr/local/lib/python2.7/dist-packages/scrapy/middleware.py", line 36, in from_settings
mw = mwcls.from_crawler(crawler)
File "/usr/local/lib/python2.7/dist-packages/scrapy/pipelines/media.py", line 51, in from_crawler
pipe = cls.from_settings(crawler.settings)
File "/usr/local/lib/python2.7/dist-packages/scrapy/pipelines/images.py", line 95, in from_settings
return cls(store_uri, settings=settings)
exceptions.TypeError: __init__() got an unexpected keyword argument 'settings'

error while auto downloading a report through selenium and python

I'm doing automation of a website and auto downloading a report through selenium and python and I get this error:
C:\Windows\system32>
C:\Python27\python.exeC:\Python27\Scripts\MH_Download3.py
Traceback (most recent call last):
File "C:\Python27\Scripts\MH_Download3.py", line 111, in <module>
driver = webdriver.Firefox(firefox_binary=binary)
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 80, in __init__self.binary, timeout)
File`"C:\Python27\lib\sitepackages\selenium\webdriver\firefox\extension_connection.py", line 52, in __init__self.binary.launch_browser(self.profile, timeout=timeout)
File "C:\Python27\lib\sitepackages\selenium\webdriver\firefox\firefox_binary.py", line 67, in launch_browserself._start_from_profile_path(self.profile.path)
File "C:\Python27\lib\sitepackages\selenium\webdriver\firefox\firefox_binary.py", line 90, in _start_from_profile_path env=self._firefox_env)
File "C:\Python27\lib\subprocess.py", line 709, in __init__ errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 957, in _execute_child startupinfo)
WindowsError: [Error 2] The system cannot find the file specified