Python - C Compile errors - gcc failed - python

Oftentimes when I try to install a Python package, installation will fail with following error: "error: command 'gcc' failed with exit status 1".
I am at loss. Most things I try to instal fail. I am losing my mind on this. Really like the language, but this is driving me crazy. Spent countless hours looking for solutions, to no avail.
Probably the problem comes from my environment. Here's how I am (insanely?) trying to run things:
Windows 7 machine
MS Visual C++ 14 redist freshly installed
Python 2.7.15 through Jupyter/SageMath 8.3 (can't execute Python through Console because throws 16bit error)
P.s.: I'm an ignorant, but I know it, so don't bother. Any help appreciated.

Ok, I found a workaround/solution.
I am suspecting that the Python kernel provided with SageMath is not a 100% complete/functional Python kernel/core. I reluctantly conceded to install a standalone Python "kernel" (not certain the term is technically correct) from Python.org, v. 2.7.15, using the standard prebuilt binaries for x64 Windows systems. Installed it in a different folder than Sage of course, added it to the system Path variable, and guess what? Yeah, issues resolved. Everything now installs flawlessly - well, mostly, but at least now it's down to an acceptable level of failure. So I installed Jupyter on this kernel and I can now continue my development the way I like it.
I mean, I would if a few hundred lines of code weren't too many for the computer on which I am working... Since it's lagging a bit, I will need to resort to other 'IDE' solutions. But that's another story altogether...
Thanks much nonetheless to everybody who bothered dropping a line by. Especially #Red Cricket, who helped me reconsider my reluctancy to install another Python kernel alongside SageMath's. Not a big fan of duplication, but hey, enough time lost there.

Related

try/except block and ctrl-d/EOFError

I'm trying to learn Python.
I'm using Windows 10 on a desktop PC.
I initially went through University of Michigan's 'Python for Everyone' on the edx.org platform. For that I used the Atom editor and installed Python from www.python.org
Installed version of Python is 3.10.4.
I then uninstalled Python and Atom and installed Anaconda/Spyder. The reason for doing this was that I wanted to make use of the tools from JPL/NASA for calculating and visualizing orbits (as in orbital mechanics; search for 'AWP orbital' on Youtube, you'll see what I wanted to do). I tried initially to install the required libraries, but as I had read in a post on this site, attempting to do this in Windows 10 will probably not work, so the recommendation was to use Anaconda as it comes with literally everything. So after switching to Anaconda, I was able to run the samples that that Youtuber provided in his github, but I didn't understand enough to do anything else with it.
So, having realized that I'm in way over my head, still need to do more basic stuff in Python. I'm 47 so this stuff doesn't come easy to me. No prior programming experience other than messing around with C a bit in uni 20+ years ago to do number crunching.
Sorry for rambling on... in any case, now I'm going through the Harvard CS50 Introduction to Programming with Python on edx.org and I uninstalled Anaconda and went back to Atom and installed Python from python.org like the first time around.
Finally I'm getting to the question. Before installing Anaconda, when I used cmd or the powershell, I could use the ctrl-d to get the EOFError in a try/except block of code, but now when I use either cmd or powershell, ctrl-d just displays ^D but doesn't actually execute the break that I have after my except statement. I tried changing it to ctrl-c and changing the except to KeyboardInterrupt, and that does execute the break, but it seems it doesn't work quite the same way. It would seem that having switched to Anaconda and then back to a basic install from python.org is what caused this ctrl-d to not work anymore, but I don't have a clue as to what I need to do to restore this functionality.
Any ideas?

I/O Error: Bad File Descriptor, can not save python file

I recently uninstalled and reinstalled python, and i have not been able to save one of my programs since.
When i hit ctrl+S, IDLE throws me a window saying I/O Error: Bad file descriptor. I can not even save my file!
As it turns out i don't think it has anything to do with the actual code. No matter what is in the program, it still throws this error when i try to save, unless there is no code whatsoever!
IF anyone knows why this error is occurring, please tell me or post an updated version of the code, any help is appreciated
I am using Windows 10, Python 3.7.3 64-bit [a couple days ago i uninstalled (just through windows settings) 32-bit and installed 64 from the python website]
I have experienced the same issue.
In my case the Windows 10 Defender was the root cause.
I added in Windows Defender Ransomware Protection the python.exe of my used IDE and the issue disappears.
In Windows, it is theorically possible to install 32 bits and 64 bits versions of Python side by side, and it should work with a genuine installation. But dragons are waiting around:
it is possible to have shortcuts pointing to a wrong location.
if the PATH has been changed to allow direct usage of the python, or pip command from the command line, risk is that you use the wrong tool
if any Python environment variable has been set, problems are almost guaranteed
Furthermore, Python can be installed either for the current user or for all users, which adds more possibilities for inconsistancies.
Once an installation is deemed broken, uninstalling one of the versions is generally useless on can even cause more problems. Long story short, if you have entered the world of inconsistancy, you must clean up everything.
My advice here is:
find where the Python versions were installed and note it
find if additional tools (py) have been installed and try to find which ones
uninstall every Python version
control that the installation paths are empty
search the environment and PATH for any Python related information and remove them
When everything looks good, reinstall from the installation wizard.
Hopefully it should work. If it does not I cannot help: despite being presented as an end user friendly system, Windows is a very feature rich and complex OS and trying to fully analyze a Windows system is beyond the capacity of most users, including most power users and sysadmins. At a point, the only possibility left is to reinstall the full OS and then cleanly install everything back... when it is possible...

Completely remove Python from Yosemite machine

I'm having issues with Python on my 2013 MacBook Air. It seems to be mostly related to pathing, looking for libs in the wrong location based on where the calling lib was installed. I'd like to remove Python from my system and start fresh.
The specific reason I'm asking is due to a virtualenv problem. I created an env with the no-site-packages flag, but when I start my app with foreman, I get an error telling me that Flask isn't available yet when I open a python shell and "import flask", it works fine.
I don't really care which version of Python, or where it's installed as long as everything is consistent. Could I get advisement on how to proceed?
To be clear, I don't think this is a Yosemite issue, just mentioning it as a potential variable.

Numpy Installation: How do I fix the broken toolchain without Bash and limited permissions?

Preface: I am a Mac/Unix user and am now a little lost with Windows.
Situation: I am trying to use python on a school machine that has a 64-bit architecture and running Windows 7. I have gotten the module NetworkX to work via python setup.py install, but need the numerical libraries to be available as well.
Question: I have the identical output as this question elaborates and need to install numpy with correct dependencies. How do I do this with limited permissions?
Problems: The solution in the above link cannot be adopted in my case. I do not have Visual Studio 2008 and cannot install it due to permissions. Also, the linear algebra library that is required costs 500$, which frankly is a deal breaker. I thought I could adopt this SO solution, but I do not have access to Bash. I also cannot run .exe files due to permissions. All the modules I have installed have been using python setup.py install. Any help or suggestions are VERY much appreciated.
Could you install one of the scientific python distributions like Anaconda or Canopy? That might include everything you need. See http://scipy.org/install.html for a list of options.

Error when installing pycrypto

I'm trying to install Fabric on my PC (with Windows + setuptools). It was giving me an error, since I have older version of pycrypto.
When I was trying to install latest version I stumble upon "Unable to find vcvarsall.bat" error. I googled something about MinGW, so I installed that too. I've added it to my Windows PATH, but now i'm getting another error, which looks like this: "command 'gcc' failed: no such file or directory." What do i do now? Found something about gcc-mingw, which is some version of MinGW that could help?
Why is has to be so damn complicated :D.
New development. Managed to install pycrytpo and fabric, but still can't run anything in the latter. New error says: "ImportError: no module named win32api". Quick google search says something about PyWin, but easy_install can't find it and it looks like it's abandoned. Any ideas?
Well, it's so complicated because C (C++? Can't remember what they used at the moment, but I am pretty sure they used C) is much, much better at math than Python, so the math pieces of PyCrypto are all written in C. It does have a _slowmath module if the compiled versions aren't available, but it's name is telling... it is much slower.
gcc is the GNU Compiler Collection (<!-- an edit, I had thought it stood for GNU C Compiler, but apparently my knowledge was dated). It is a bit legendary, but apparently your version of Windows has not heard of it. First question though, have you closed the "DOS prompt" and restart it? (it's in quotes because the people at superuser once yelled at me because I did not sufficiently acknowledge its inferiority) Environment Variables in Windows do not update during a "DOS session" (or whatever it is supposed to be called).
If you have, chances are that it can be found inside of the MingW install director -- if there is a bin folder I'd check there first. If not, I would search for gcc.exe and make sure that it's path is part of PATH. Then,
If all else fails, you might be able to get more info on MingW here.

Categories

Resources