How to use Cython on Windows 10 with python 3.8 - c

I want to know how correctly convert py documents to C with help Cython
But all the time a have some error.
D:\Cython\test4>python setup.py build_ext --inplace
running build_ext
Traceback (most recent call last):
File "setup.py", line 4, in <module>
setup(ext_modules = cythonize('hello.pyx', compiler_directives={'language_level': 3}))
File "C:\Users\Alexandr\AppData\Local\Programs\Python\Python38\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\Alexandr\AppData\Local\Programs\Python\Python38\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Users\Alexandr\AppData\Local\Programs\Python\Python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Alexandr\AppData\Local\Programs\Python\Python38\lib\distutils\command\build_ext.py", line 306, in run
self.compiler = new_compiler(compiler=self.compiler,
File "C:\Users\Alexandr\AppData\Local\Programs\Python\Python38\lib\distutils\ccompiler.py", line 1032, in new_compiler
return klass(None, dry_run, force)
File "C:\Users\Alexandr\AppData\Local\Programs\Python\Python38\lib\distutils\cygwinccompiler.py", line 282, in __init__
CygwinCCompiler.__init__ (self, verbose, dry_run, force)
File "C:\Users\Alexandr\AppData\Local\Programs\Python\Python38\lib\distutils\cygwinccompiler.py", line 157, in __init__
self.dll_libraries = get_msvcr()
File "C:\Users\Alexandr\AppData\Local\Programs\Python\Python38\lib\distutils\cygwinccompiler.py", line 86, in get_msvcr
raise ValueError("Unknown MS Compiler version %s " % msc_ver)
ValueError: Unknown MS Compiler version 1916
I have hello.pyx file, which includes this code
cpdef int test(int x):
cdef int y = 1
cdef int i
for i in range(1, x+1):
y *= i
return y
Setup.py file includes
from distutils.core import setup
from Cython.Build import cythonize
setup(ext_modules = cythonize('hello.pyx', compiler_directives={'language_level': 3}))
Microsoft Visual Studio has installed, gcc compiler also installed. What should I do?

Hey I found simple solution. Just install Microsfot Visual Studio (community version works). Make sure you got MSVC and Windows 10 SDK checked. I was told both are required.
Select Desktop C++ development:
Select MSVC and Win10 SDK:
After install restart pc. It should compile with python setup.py build_ext --incplace

Related

NRF SDK 1.8 - CONFIG_BOOTLOADER_MCUBOOT makes fail build process

I want to use fota library, i enabled MCUBOOT but my program won't build after that. I'm using NRF SDK 1.8 with Zephyr 2.7.0
That's what i get :
Traceback (most recent call last):
File "C:/Users/ABC/workspace_visual_studio/project_Sc/iris_project_Sc/external/sdk/zephyr/scripts/zephyr_module.py", line 486, in <module>
main()
File "C:/Users/ABC/workspace_visual_studio/project_Sc/iris_project_Sc/external/sdk/zephyr/scripts/zephyr_module.py", line 480, in main
meta = process_meta(args.zephyr_base, west_proj, modules)
File "C:/Users/ABC/workspace_visual_studio/project_Sc/iris_project_Sc/external/sdk/zephyr/scripts/zephyr_module.py", line 298, in process_meta
'revision': git_revision(project_path)}
File "C:/Users/ABC/workspace_visual_studio/project_Sc/iris_project_Sc/external/sdk/zephyr/scripts/zephyr_module.py", line 263, in git_revision
rc = subprocess.Popen(['git', 'rev-parse', '--is-inside-work-tree'],
File "subprocess.py", line 854, in __init__
File "subprocess.py", line 1307, in _execute_child
NotADirectoryError: [WinError 267] Nom de répertoire non valide
ninja: build stopped: subcommand failed.
How are you enabled mcumgr for your project ?
Have you added all the required configuration in your prj.conf file ?
it would be better if you elaborate on your build logs.
for folder structure you can refer this.Overlay folder structure

Error Importing Pandas in Volttron Platform

I have created a Volttron agent and trying to use pandas library.
But I am getting error of pandas not being installed, while its there.
ERROR:volttron.platform.packaging:b'Traceback (most recent call last):\n File "setup.py", line 11, in <module>
_temp = __import__(agent_module, globals(), locals(), [\'__version__\'], 0)
File "/tmp/tmpd_5srlls/pkg/weather/agent.py", line 12, in <module>
import pandas as pd
File "/home/pi/volttron/env/lib/python3.7/site-packages/pandas/__init__.py", line 17, in <module>
"Unable to import required dependencies:\\n" + "\\n".join(missing_dependencies)
ImportError: Unable to import required dependencies:\nnumpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was\ninstalled.\n\nWe have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html\n\nPlease note and check the following:\n\n * The Python version is: Python3.7 from "/home/pi/volttron/env/bin/python"
* The NumPy version is: "1.19.5"\n\nand make sure that they are the versions you expect.\nPlease carefully study the documentation linked above for further help.Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory\n\n'
Traceback (most recent call last):
File "scripts/install-agent.py", line 340, in <module>
if not os.path.isfile(opts.package):
File "/usr/lib/python3.7/genericpath.py", line 30, in isfile
st = os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
The shared library cannot be located. Please try:
sudo apt-get install libatlas-base-dev

google-cloud-pubsub installation fails in coral developer board

Environment details:
Python 3.7.3
setuptools==51.0.0
I am just trying to install google-cloud-pubsub in coral developer board using the command,
pip install --upgrade --no-cache google-cloud-pubsub
When running the above command, it started installing the dependencies then after it goes for some grpcio build process as shown below.
Build log:
Building wheels for collected packages: grpc-google-iam-v1, grpcio
Building wheel for grpc-google-iam-v1 (setup.py) ... done
Created wheel for grpc-google-iam-v1: filename=grpc_google_iam_v1-0.12.3-py3-none-any.whl size=18501 sha256=2be51c55f5cab3ff97efdb39e3a6be07e5c2d030ca0a47a8358a8fa1efef58b6
Stored in directory: /tmp/pip-ephem-wheel-cache-rpj8jh5r/wheels/b9/ee/67/2e444183030cb8d31ce8b34cee34a7afdbd3ba5959ea846380
Building wheel for grpcio (setup.py) ... error
This process hangs for several minutes and got the error logs shown below printed.
Error:
Building wheel for grpcio (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/mendel/.virtualenvs/cv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1pbjozx4/grpcio_3a1c8f81c7024b04bd7534fe601796ee/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1pbjozx4/grpcio_3a1c8f81c7024b04bd7534fe601796ee/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-1u5g0n_z
cwd: /tmp/pip-install-1pbjozx4/grpcio_3a1c8f81c7024b04bd7534fe601796ee/
Complete output (1234 lines):
ASM Builds for BoringSSL currently not supported on: linux-aarch64
Found cython-generated files...
running bdist_wheel
......................
lot of lines there ...!
......................
Traceback (most recent call last):
File "/tmp/pip-install-1pbjozx4/grpcio_3a1c8f81c7024b04bd7534fe601796ee/src/python/grpcio/commands.py", line 267, in build_extensions
build_ext.build_ext.build_extensions(self)
File "/usr/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/usr/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/home/mendel/.virtualenvs/cv/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 196, in build_extension
_build_ext.build_extension(self, ext)
File "/usr/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
depends=ext.depends)
File "/tmp/pip-install-1pbjozx4/grpcio_3a1c8f81c7024b04bd7534fe601796ee/src/python/grpcio/_parallel_compile_patch.py", line 59, in _parallel_compile
_compile_single_file, objects)
File "/usr/lib/python3.7/multiprocessing/pool.py", line 268, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/usr/lib/python3.7/multiprocessing/pool.py", line 657, in get
raise self._value
File "/usr/lib/python3.7/multiprocessing/pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "/usr/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
return list(map(*args))
File "/tmp/pip-install-1pbjozx4/grpcio_3a1c8f81c7024b04bd7534fe601796ee/src/python/grpcio/_parallel_compile_patch.py", line 54, in _compile_single_file
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/usr/lib/python3.7/distutils/unixccompiler.py", line 120, in _compile
raise CompileError(msg)
distutils.errors.CompileError: command 'aarch64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for grpcio
Running setup.py clean for grpcio
Note: I have successfully installed google-cloud-storage==1.33.0

dronekit install error: instructions are not working

I followed the instructions to install dronekit-python as described in the Getting Started page.
I ran the following command:
pip install dronekit
and I got a message:
Cold notfind a version that satisfies the requirements dronekit (from
versions: 2.0.0b2 .... 2.0.0rc9)
I did as scaredrone has prescribed two days ago:
pip install dronekit=2.0.0rc4
and I got the exception:
Exception:
Traceback (most recent call last):
File "C:\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\pip\commands\install.py", line 257, in run
InstallRequirement.from_line(name, None))
File "C:\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\pip\req.py", line 172, in from_line
return cls(req, comes_from, url=url, prereleases=prereleases)
File "C:\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\pip\req.py", line 70, in __init__
req = pkg_resources.Requirement.parse(req)
File "C:\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\pip\_vendor\pkg_resources.py", line 2606, in parse
reqs = list(parse_requirements(s))
File "C:\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\pip\_vendor\pkg_resources.py", line 2544, in parse_requirements
line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
File "C:\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\pip\_vendor\pkg_resources.py", line 2512, in scan_list
raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', 'dronekit=2.0.0rc4', 'at', '=2.0.0rc4')
I had the same problem. Try to run
sudo pip install --pre dronekit
the --pre flag enables installation of pre-release software.
Don't know why it hasn't been documented.
Answer from here: https://discuss.dronekit.io/t/pip-install-dronekit-fails-on-odroid-xu4-unless-pre-is-used/93

Nose GAE : Cannot import dev_appserver, but app engine is still in PYTHONPATH

I am getting the following error when trying to run the nosetest from my GAE project:
nosetests --nologcapture --with-gae --without-sandbox --gae-lib-root=/Users/dsinha/Dropbox/code/google-cloud-sdk/platform/google_appengine
but I get the following error:
Traceback (most recent call last):
File "/usr/local/bin/nosetests", line 8, in <module>
load_entry_point('nose==1.3.4', 'console_scripts', 'nosetests')()
File "/Library/Python/2.7/site-packages/nose/core.py", line 121, in __init__
**extra_args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 94, in __init__
self.parseArgs(argv)
File "/Library/Python/2.7/site-packages/nose/core.py", line 145, in parseArgs
self.config.configure(argv, doc=self.usage())
File "/Library/Python/2.7/site-packages/nose/config.py", line 346, in configure
self.plugins.configure(options, self)
File "/Library/Python/2.7/site-packages/nose/plugins/manager.py", line 284, in configure
cfg(options, config)
File "/Library/Python/2.7/site-packages/nose/plugins/manager.py", line 99, in __call__
return self.call(*arg, **kw)
File "/Library/Python/2.7/site-packages/nose/plugins/manager.py", line 167, in simple
result = meth(*arg, **kw)
File "/Library/Python/2.7/site-packages/nosegae.py", line 87, in configure
from google.appengine.tools import old_dev_appserver as dev_appserver
ImportError: cannot import name old_dev_appserver
The sys.path reads:
'/Users/dsinha/Downloads/eclipse/plugins/org.python.pydev_3.9.0.201411111611/pysrc', '/Users/dsinha/Dropbox/code/google-cloud-sdk/platform/google_appengine/lib/antlr3', '/Users/dsinha/Dropbox/code/google-cloud-sdk/platform/google_appengine/lib/fancy_urllib', '/Users/dsinha/Dropbox/code/google-cloud-sdk/platform/google_appengine/lib/ipaddr', '/Users/dsinha/Dropbox/code/google-cloud-sdk/platform/google_appengine/lib/yaml-3.10', '/Users/dsinha/Dropbox/code/google-cloud-sdk/platform/google_appengine/lib/rsa', '/Users/dsinha/Dropbox/code/google-cloud-sdk/platform/google_appengine/lib/pyasn1', '/Users/dsinha/Dropbox/code/google-cloud-sdk/platform/google_appengine/lib/pyasn1_modules', '/Users/dsinha/Dropbox/code/google-cloud-sdk/platform/google_appengine', '/Users/dsinha/Dropbox/code/google-cloud-sdk/platform/google_appengine/lib/simplejson', '/Users/dsinha/Dropbox/code/google-cloud-sdk/platform/google_appengine/lib/django-1.4', '/Users/dsinha/Dropbox/code/google-cloud-sdk/platform/goo...
so the app engine libraries should be getting pulled in. Actually its first failing to pull in dev_appserver, and then trying and failing to pull old_dev_appserver
The dir inside the appengine/lib file is:
bash-3.2$ ls
__init__.py appcfg.py backends_xml_parser.py dispatch_xml_parser.py handler_generator.py php_cli.py value_mixin.pyc
__init__.pyc appcfg_java.py boolean_action.py docker handler_generator.pyc queue_xml_parser.py web_xml_parser.py
adaptive_thread_pool.py appengine_rpc.py boolean_action.pyc dos_xml_parser.py jarfile.py queue_xml_parser.pyc web_xml_parser.pyc
api_server.py appengine_rpc.pyc bulkload_client.py download_appstats.py java_quickstart.py remote_api_shell.py xml_parser_utils.py
app_engine_config_exception.py appengine_rpc_httplib2.py bulkloader.py endpointscfg.py java_quickstart.pyc requeue.py xml_parser_utils.pyc
app_engine_config_exception.pyc augment_mimetypes.py cron_xml_parser.py gen_protorpc.py java_utils.py sdk_update_checker.py yaml_translator.py
app_engine_web_xml_parser.py augment_mimetypes.pyc dev-channel-js.js handler.py java_utils.pyc sdk_update_checker.pyc yaml_translator.pyc
app_engine_web_xml_parser.pyc backends_conversion.py devappserver2 handler.pyc os_compat.py value_mixin.py
bash-3.2$ pwd
/Users/dsinha/Dropbox/code/google-cloud-sdk/platform/google_appengine/google/appengine/tools
I also tried to find the modules available inside the google.appengine.tools package:
>>> import pkgutil
>>> [name for _, name, _ in pkgutil.iter_modules(['testpkg'])]
[]
This problem started occuring after I upgraded to App Engine 1.9.10 (to use the async search features). In a problem that I think is related, when I try to run the debug server from PyDev, it just silently terminated on any page request (localhost:8080).
Running dev_appserver . from the command line works fine though.
Nose-GAE broke with App Engine 1.9.17: https://github.com/Trii/NoseGAE/issues/6
Downgrading to 1.9.15 made the problem go away temporarily while waiting for the issue to be resolved by nose-gae

Resources