matplotlib issues installing on windows - python

I'm trying to install matplotlib on windows using easy-install and also I tried pip, but I'm getting the error below, how can I fix this
error: Setup script exited with error: Could not initialize compiler instance: do you have Visual Studio installed? If you are trying to build with mingw, please use python setup.py
build -c mingw32 instead. If you have Visual Studio installed, check it is
correctly installed, and the right version (VS 2008 for python 2.6, VS 2003 for
2.5, etc...). Original exception was: Unable to find vcvarsall.bat, and the Compiler class was MSVCCompiler
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Python26\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "C:\Python26\lib\multiprocessing\util.py", line 270, in _exit_function
info('process shutting down')
TypeError: 'NoneType' object is not callable
Error in sys.exitfunc:
Traceback (most recent call last):
File "C:\Python26\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "C:\Python26\lib\multiprocessing\util.py", line 270, in _exit_function
info('process shutting down')
TypeError: 'NoneType' object is not callable
C:\Python26\Scripts>

Compiling C extensions on Windows requires VisualStudio Express in the most cases and will be far from easy. Instead you can download the binary package for your Python version to a local directory and install with easy_install like so:
easy_install "C:\path_to_local_binary_dir\matplotlib-1.3.1-win-xxx.exe"
(replace with full path/filename). This will not show up in Add/Remove programs and also works for virtual envs.

Related

pycharm debug on m1 mac fails with: `pydevd_cython_darwin_310_64.cpython-310-darwin.so incompatible architecture`

I just upgraded to pycharm 2022.01 and got an error when debugging a python program using m1 mac:
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_cython_wrapper.py", line 8, in <module>
from _pydevd_bundle_ext import pydevd_cython as mod
ModuleNotFoundError: No module named '_pydevd_bundle_ext'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_cython_wrapper.py", line 11, in <module>
from _pydevd_bundle import pydevd_cython as mod
ImportError: cannot import name 'pydevd_cython' from '_pydevd_bundle' (/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 55, in <module>
from _pydevd_bundle.pydevd_trace_dispatch import (
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_trace_dispatch.py", line 42, in <module>
from _pydevd_bundle.pydevd_cython_wrapper import trace_dispatch as _trace_dispatch, global_cache_skips, global_cache_frame_skips, fix_top_level_trace_and_get_trace_func
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_cython_wrapper.py", line 35, in <module>
mod = getattr(__import__(check_name), mod_name)
ImportError: dlopen(/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_cython_darwin_310_64.cpython-310-darwin.so, 0x0002): tried: '/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_cython_darwin_310_64.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
Process finished with exit code 1
I installed the right version of pycharm. Couldn't find the right .so version on pypi.
How can I fix this? Is it possible to recompile pydevd for arm64e?
Managed to rebuild pydevd that comes with PyCharm:
Rebuild the binaries
Make sure you have cython installed to update and compile the cython sources:
sudo pip3 install cython
export PYTHONPATH=/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev:$PYTHONPATH
cd /Applications/PyCharm.app/Contents/plugins/python/helpers/pydev
python3.10 build_tools/build.py
After that, debugging in PyCharm worked fine.
Check the binaries
What the rebuild apparently did:
removed all _pydevd_bundle/pydevd_cython_darwin_*.so files
created only _pydevd_bundle/pydevd_cython.cpython-310-darwin.so
Use the file command to confirm the binary has the architecture required for new M1 (Apple Silicon) chips:
file _pydevd_bundle/pydevd_cython.cpython-310-darwin.so`
It should output required architecture for M1 like arm64 below:
_pydevd_bundle/pydevd_cython.cpython-310-darwin.so: Mach-O 64-bit bundle arm64
As a quickfix, you can simply disable cython debugging. This will still enable you to run a debugging session, albeit with less features.
Add this to the environment variables of your run configuration in PyCharm:
PYDEVD_USE_CYTHON=NO

TypeError: __init__() missing 1 required positional argument: 'msg' everytime i try to download anaconda3 on macbook

I am trying to download anaconda3 terminal version for a 64bit mac OS Catalina to use for python 3.7, and i keep running into the error:
Unpacking payload ...
concurrent.futures.process._RemoteTraceback:
'''
Traceback (most recent call last):
File "concurrent/futures/process.py", line 368, in _queue_management_worker
File "multiprocessing/connection.py", line 251, in recv
TypeError: __init__() missing 1 required positional argument: 'msg'
'''
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "entry_point.py", line 69, in <module>
File "concurrent/futures/process.py", line 484, in _chain_from_iterable_of_lists
File "concurrent/futures/_base.py", line 611, in result_iterator
File "concurrent/futures/_base.py", line 439, in result
File "concurrent/futures/_base.py", line 388, in __get_result
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.
[16126] Failed to execute script entry_point
all i am trying to do is install anaconda3 on my laptop to use for a sentiment analysis program that only runs on python 3.7 (otherwise i would use google colab). this is my first time trying to run python on terminal, and it has been such a headache.
i have no idea what is going wrong. i cannot access jupyter notebook without anaconda, and anaconda refuses to install correctly. any help would be greatly appreciated, this is driving me nuts.
are there any better apps through which i can use python 3.7 without having to go through this pain??? extremely frustrating.
It seems that you are running out of space
I met the question on x86, when I use sudo sh Anaconda.sh, it runs well.
But when I just use sh Anaconda.sh, it returns this problem.
Why dont use sudo sh Anaconda.sh for me? Because after install Anaconda, when you need install packages, it warns that you need sudo conda xxx, it's so inconvinient.
You can try sudo to install Anaconda to see if we have the same problem.

Can't get pywin32-219 to work with python 3.5

It seems to install without error using the EXE (in my case pywin32-219.win-amd64-py3.5.exe) however when run the python interpreter and try to "import win32api" I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.
If I download the zip file and try to run "setup3.py install" I get the following output:
Converting...
Executing...
Building pywin32 3.5.219.0
Traceback (most recent call last):
File "setup3.py", line 16, in <module>
exec(str(got))
File "<string>", line 1929, in <module>
File "<string>", line 587, in __init__
File "C:\Python35\lib\ntpath.py", line 113, in join
genericpath._check_arg_types('join', path, *paths)
File "C:\Python35\lib\genericpath.py", line 143, in _check_arg_types
(funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'
I've tried a couple of things but cant get it to work.
Has anyone gotten pywin32 to install and work correctly with python 3.5?
You need to run the pywin installer with elevated permissions as it writes to the system32 folder. If you didn't run with elevated permissions, open an admin cmd prompt and run the postinstall script in the pywin install directory.
The compiling from source error is related to pywin32 not catching an error that ends up crashing everything. Specifically line 587 of setup.py causes a crash if sdk_dir is None.
Changing line 587 to
if sdk_dir and os.path.isfile(os.path.join(sdk_dir, "include", "activdbg.h")):
prevents that crash, but my installation later crashes with the following error:
win32/src/win32wnet/PyNetresource.cpp(120): error C2440: 'initializing':
cannot convert from 'int (__cdecl *)(PyObject *,PyObject *)' to 'PyAsyncMethods *'win32/src/win32wnet/PyNetresource.cpp(120): note: There is no context in which this conversion is possible
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2

Installing PYMC on Win64 - but MinGW does not seem to compile

I'm trying to install PYMC on a Win7-64 machine, using Python 2.7.3, installed as part of Python(x, y).
I've attempted to use python setup.py install, but that didn't work. I then went down the route of installing MinGW and MSYS as per these instructions http://pymc-devs.github.io/pymc/INSTALL.html, but I still have the error message below. I have added the details to my path.
I have also tried using the MCMC linked to via https://groups.google.com/forum/#!searchin/pymc/install$20windows/pymc/_10AZdgd620/wFPh4qium8QJ and the additional compiler details listed here https://groups.google.com/forum/#!topic/pymc/1-ENfS5NBQE and here http://ultrainfinitum.blogspot.co.uk/2012/12/python-error-unable-to-find-vcvarsallbat.html, which state to use the following compiler commands, setup.py install build --compiler=mingw32 or python setup.py build --force -c mingw32, then python setup.py install --force --skip-build.
The error message I'm getting is as follows:
error: Setup script exited with error: Unable to find vcvarsall.bat
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "c:\Python27\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "c:\Python27\lib\multiprocessing\util.py", line 284, in _exit_function
info('process shutting down')
TypeError: 'NoneType' object is not callable
Error in sys.exitfunc:
Traceback (most recent call last):
File "c:\Python27\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "c:\Python27\lib\multiprocessing\util.py", line 284, in _exit_function
info('process shutting down')
TypeError: 'NoneType' object is not callable
Any ideas on what to try next?
Quick Solution (with Visual Studio Express)
Install Visual Studio Express. This will give you all the vcvarsall.* dependencies.
Using MinGW
Make sure to select the C, C++ and other dev tools to ensure you get make.exe.
After this, set your PATH to include MinGW32's bin directory as well as msys\1.0\bin
Edit the distutils.cfg file located at C:\Python26\Lib\distutils\distutils.cfg to set your compiler options.
[build]
compiler=mingw32

Installing Python Packages - IronPython

I'd like to add the PRAW package to an IronPython solution in VS however it's proving to be a pain in the butt. Here are steps I'm taking
right-click on IronPython Environment, select install python package.
type in "Praw" using pip
I get a prompt telling me that pip needs to get installed.
I then see the following:
Installing 'pip' package manager.
Downloading distribute from https://go.microsoft.com/fwlink/?LinkID=306663
Installing from distribute-0.6.45
Before install bootstrap.
Scanning installed packages
Setuptools installation detected at c:\program files (x86)\ironpython 2.7\lib\site-packages\setuptools-0.6c11-py2.7.egg
Egg installation
Already patched.
running install
Traceback (most recent call last):
File "setup.py", line 147, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\distutils\core.py", line 151, in setup
File "C:\Program Files (x86)\IronPython 2.7\Lib\distutils\dist.py", line 952, in run_commands
File "C:\Program Files (x86)\IronPython 2.7\Lib\distutils\dist.py", line 971, in run_command
File "c:\users\mj\appdata\local\temp\ptvs-9jvsvw-pip_downloader\distribute-0.6.45\setuptools\command\install.py", line 63, in run
AttributeError: 'module' object has no attribute '_getframe'Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\2.0\pip_downloader.py", line 47, in <module>
File "C:\Program Files (x86)\IronPython 2.7\Lib\subprocess.py", line 512, in check_call
subprocess.CalledProcessError: Command '['C:\\Program Files (x86)\\IronPython 2.7\\ipy64.exe', 'setup.py', 'install']' returned non-zero exit status 1
'pip' failed to install. Exit code: 1
With the reason for the failed install being: AttributeError: 'module' object has no attribute '_getframe'Traceback (most recent call last):
How do I get around this? Is there a way to install pip and for ironpython in a different manner? Is there a way to install packages/libraries by not having to use pip? I can install the package just fine via Pip for python 2.7.
You have to run IronPython with the command line option -X:FullFrames. I'm not sure, though, how to set that up in the VS.
Maybe you can manually run it:
C:\path\to\ipy64.exe -X:FullFrames path\to\pip.py install whaterver_you_want

Categories