Segmentation Fault: 11 on OSX python - python

I'm getting an intermittant segfault in python, which really shouldn't happen. It's a heisenbug, so I haven't figured out exactly what's causing it.
I've done the search and found that there was a known problem with an older version of python, but I'm using 2.7.10 (in a virtualenv, in case that matters)
I'm using pandas (0.18.0) , scipy(0.17.0) and numpy (1.11.0), in case the problem might be in there...

It looks like: How to generate core dumps in Mac OS X?
might be the best way to get stack trace...it appears in ~/Library/Logs/DiagnosticReports I'm not sure if it's USEFUL, and it's not a core per se, to be put into a debugger, but it's something...

Related

Error occurring when I execute commands in Python

I have just gotten a new computer and I had to reinstall anaconda (python version 3.7.3) and I am getting the following error when I execute commands. There does not seem to be any specific commands that it happens with, I can't correlate it with any one module.
C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\ipkernel.py:448: DeprecationWarning: `input_splitter` is deprecated since IPython 7.0, prefer `input_transformer_manager`.
status, indent_spaces = self.shell.input_splitter.check_complete(code)
After searching online, it seems like one of my dependencies might be causing this. At first I thought it was geopandas or numpy but i don't think it is. I am relatively new to python so if anyone has any advice on how to solve this, that would be great.
thanks

Create a mess I need to clean up, while trying to solve conflicts between Macbook Pro M1 and Tensorflow library

I have a 2021 Macbook pro M1.
It is a well recognized problem that it conflicts with Tensoflow library, see here or here; in particular this last one was exactly the issue I experienced: when I tried to import tensorflow in jupyter notebook via the command
import tensorflow as tf
then the message
The kernel appears to have died. It will restart automatically.
appeared. Then searching in the above linked discussions, I have the feeling that the suggestion given at some point, which points at this link, SEEMS to be useful.
FIRST QUESTION: is this a/the solution for the M1-Tensorflow conflict?
I say "it seems" since before trying that I have been into the kind of tornado of desperate attempts leading a beginner like me to search for hints all around the web and then copy-paste commands taken here and there into the Terminal without understanding them all properly.
On one hand it sounds dumb, I admit, on the other the cost of understanding everything goes well beyond my humble intentions of learning some ML.
So, the final result is that I have a complete mess in my computer; the old libraries like numpy don't work anymore (when I import them inside a Python3 page opened with jupyter notebook with the command import numpy as np, the message
ModuleNotFoundError: No module named 'numpy'
appears), then the pip command doesn't work, if I use the pip3 to install, nothing changes. I read somewhere to use a virtual enviroment, and I followed the instructions even if I wasn't really aware of what I was doing; I downloaded XCode, miniforge3...
Well, I guess that there is somebody out there who can relate with this.
SECOND PROBLEM: I would like to clean-up everything dealing with Python/pip/anaconda and so on and install everything from scratch, possibly following the above link to solve the M1-tensorflow conflict...if it is correct. How can I do that?
Can somebody help me, please? Thanks

Python reportlab pyRXP on OS X

So I am trying to install pyRXP on my os x machine (using anaconda).
If I use pip, import pyRXP doesn't work,
I have also tried to install by cloning https://bitbucket.org/rptlab/pyrxp
and running the setup.py file
It claims I need to compile something if I am not on windows, but I can't work out what, where that source is.
Sorry I am kind of new to python, and this has become very confusing, no amount of googling is helping.
Cheers for any help.
In newer versions of pyRXP, the module seems to have been renamed to pyRXPU. Something about supporting Unicode.
It seems that pyRXP (which supported 8 bit characters) has been removed and only pyRXPU (supporting 16 bit unicode characters) is in the package now, although the documentation still suggests you can import pyRXP! I've submitted an issue about this.
The only solution, if using the latest version of pyRXP (as suggested by the previous answer), is to instead do:
import pyRXPU
Update: The documentation, and README file in the repository, have now been fixed to only reference import pyRXPU and no longer use import pyRXP.

Importing a module into python with a period in the path

I'm having trouble importing numpy into my script because of some path-name issues.
I'm running my script with python 2.7, rather than the default 2.6 on my server because I need some of the updates in the Collections module. I cant seem to import numpy like:
from numpy.random import poisson
So I am trying to use the python2.7 specific links to numpy on my server, which are installed in:
/opt/lib/python2.7/numpy
But this period in the path is really making this difficult. I cannot change the path in anyway.
I've found a similar problem here, but frankly the code just doesn't make enough sense to me for me to feel safe using it (plus several commenters seemed to suggest it was a bad idea.). If someone has another suggestion, or if you can give me a good explanation of the code there I would appreciate it.
Try setting PYTHONPATH to point to /opt/lib/python2.7, after which import numpy et cetera should pull libraries from there.
$ PYTHONPATH=/opt/lib/python2.7 python27 my_script.py

connecting Python 2.6.1 with MySQLdb

I am using Python 2.6.1 and I want to connect to MySQLdb, I installed mySQL in my system, and I am trying to connect MySQL-python-1.2.2.win32-py2.6 from http://www.codegood.com/archives/4 site but its not working
while running my application its saying that No module named MySQLdb
please any one provide me the proper setup for MySQLdb.
thanks in advance
The best setup for Windows that I've found:
http://www.codegood.com/downloads?dl_cat=2
EDIT: Removed original link (it's an ad farm now :( )
The module is not likely in your python search path..
Check to see if that module is in your Python Path... In windows...you may find it in the registry
HKLM\Software\Python\PythonCore\2.6\PythonPath
Be careful editing it...
You may also alter the Python Path programmaticly by the following
import sys
sys.path.append('somepath_to_the_module_you_wanted')
import the_module_you_wanted
Hope that helps
I was having this problem and then I realised I was importing MySQLdb erroneously - it's case sensitive:
Incorrect: >>>import mysqldb
Correct: >>>import MySQLdb
Silly mistake, but cost me a few hours!
generally, (good) python modules provide a 'setup.py' script that takes care of things like proper installation (google for 'distutils python'). MySQLdb is a "good" module in this sense.
since you're using windows, things might be a bit more complex. I assume you already installed MySQLdb following the instructions and it still gives this problem. what I would do is open a cmd.exe window, cd to the directory containing the 'setup.py' script and there type something like
C:\Python26\Python.exe setup.py install
if this does not work, then grab the module somewhere else, maybe at the place where it is actively developed: http://sourceforge.net/projects/mysql-python/
See this post on the mysql-python blog: MySQL-python-1.2.3 beta 2 released - dated March 2009. Looks like MySQLdb for Python 2.6 is still a work in progress...
I went for compiled binary , thats the best way to go on windows. There is a good source maintained by someone.
I wrote about it here before because some months down the lane I will forget how I solved this and be searching Stack again :/
http://vangel.3ezy.com/archives/101-Python-2.4-2.5-2.6-and-2.7-Windows-MySQLdb-python-installation.html

Categories