Memory Error with half-full memory - python

I have a well built project in Python 2.7 using Windows7. It works well before today, and I just running it without modifying it for weeks.
Today, when I open it and try to run it, it gives me some ImportError which says numpy and wx package are not valid Win32 applications. So I re-install these packages (32-bit versions). Then it is executable.
However, the thing is getting even weird, it keeps giving memory error. I was watching the task manager, and can obviously see that when the error pops, the memory is just half-full.
May I know how I can make it works properly?
Thanks.
EDIT:
I've tried to install 64 bit version of Numpy to replace the 32 bit one. However, the memory error pops again.
EDIT2:
Following is the trace back numpy import error:
Traceback (most recent call last):
File "C:\Users\user\My Documents\Aptana Studio 3 Workspace\State Machine Version 4.0\main.py", line 9, in <module>
import numpy as np
File "C:\Python27\lib\site-packages\numpy\__init__.py", line 154, in <module>
import add_newdocs
File "C:\Python27\lib\site-packages\numpy\add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "C:\Python27\lib\site-packages\numpy\lib\__init__.py", line 4, in <module>
from type_check import *
File "C:\Python27\lib\site-packages\numpy\lib\type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "C:\Python27\lib\site-packages\numpy\core\__init__.py", line 5, in <module>
import multiarray
ImportError: DLL load failed: %1 is not a valid Win32 application.
EDIT3:
I've installed 32-bit numpy again. Now the memory error is back. The trace back is as follows:
Traceback (most recent call last):
File "C:\Users\user\My Documents\Aptana Studio 3 Workspace\State Machine Version 4.0\main.py", line 55, in <module>
portfolio = Portfolio(portfolio_path, recovery_tree_path, tree_rule_path, output_path, history_length, horizon, simulation_number, simulation_mode, adjustment_mode, adjustment_node_list, segmentation_flag, segmentation_variable)
File "C:\Users\user\My Documents\Aptana Studio 3 Workspace\State Machine Version 4.0\PortfolioClass.py", line 131, in __init__
self.LoadFromCSV()
File "C:\Users\user\My Documents\Aptana Studio 3 Workspace\State Machine Version 4.0\PortfolioClass.py", line 139, in LoadFromCSV
self.load_accounts()
File "C:\Users\user\My Documents\Aptana Studio 3 Workspace\State Machine Version 4.0\PortfolioClass.py", line 217, in load_accounts
acc = Account(account_id, vintage, sale_balance, LPAPerc2, Con_Score_Pre, Predicted_Contact_Type_ITC, thresholds, cost)
File "C:\Users\user\My Documents\Aptana Studio 3 Workspace\State Machine Version 4.0\AccountClass.py", line 153, in __init__
self._account_monthly_revenues = np.zeros((self._parent._simulation_number, self._parent._horizon))
MemoryError

Related

Error when analysing code (pylint) on Spyder

I use Spyder 5 (Python 3.7.9), although I also installed Python 3.9 but not with Spyder.
When I press F8 to run a Static Analysis Code, a message displays:
Traceback (most recent call last):
File "D:\obj\windows-release 37amd64_Release\msi_python\zip_amd64\runpy.py", line 193, in
_run_module_as_main
File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\runpy.py", line 85, in
_run_code
File "C:\Program Files\Spyder\pkgs\pylintmain.py", line 9, in <<module> pylint.run_pylint()
File "C:\Program Files\Spyder\pkgs\pylint_init.py", line 21, in run_pylint from pylint.lint import Run as PylintRun
File "C:\Program Files\Spyder pkgs\pylint\lint_init.py", line 75, in <module> from pylint.lint.parallel import check_parallel
File "C:\Program Files\Spyder\pkgs\pylint\lint\parallel.py", line 7, in <module>
from pylint import reporters File "C:\Program Files\Spyder\pkgs\pylint\reportersinit.py", line 25, in <module>
from pylint import utils
File "C:\Program Files\Spyder\pkgs\pylint\utils_init__.py", line 45, in <module>
from pylint.utils.ast walker import ASTWalker
File "C:\Program Files\Spyder\pkgs\pylint\utils\ast_walker.py", line 6, in <module>
from astroid import nodes
File "C:\Program Files\Spyder\pkgs\astroidinit.py", line 46, in <module>
from pathlib import Path
ModuleNotFoundError: No module named 'pathlib'
Before installing Spyder 5 (I had Spyder 3), it worked, but since I've updated Spyder, it won't anymore.
Thank you!
(Spyder maintainer here) This is a bug in our Windows installer and we'll try to fix it in our next version, to be released in June.
It look like you're in fact using python2 and not python 3.7. Your default python might be python2 so you should try using python3 instead of python when launching commands, or try changing the default python for your system (if at all possible).

Anaconda navigator not launching, not even through terminal

I installed the latest version of Anaconda on my Windows 10. After installing i tried to launch it but it wouldn't launch even after trying several times. I also tried to launch the jupyter notebook and spider shortcut that was created but even that didn't work. So I tried to run it using the terminal and this is the error I recieved:
UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
warnings.warn(
Traceback (most recent call last):
File "C:\Users\capta\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Users\capta\anaconda3\lib\site-packages\notebook\notebookapp.py", line 49, in <module>
from zmq.eventloop import ioloop
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed while importing error: The specified module could not be found.
I also encountered this problem after I uninstalled the Microsoft Visual Studio C++ redistributable. It fixed (DLL error) after I installed Visual Studio 2015, 2017, and 2019.
You can find it on The latest supported Visual C++ downloads

Run-time error: cannot import name py31compat

Have a compiled app that fails when multiarray attempts to import py31compat. It runs fine from source.
I am using Anaconda2-4.4.0-Windowsx86_64.exe (windows 7)
Using numpy-1.12.1, which was installed with pip
Compiling with py2exe script.
The error it gives is:
Traceback (most recent call last):
File "AutoFastener.py", line 23, in <module>
File "BatchControl\modBatchController.pyo", line 94, in <module>
File "FastenerDataSetUtilities\modFDDUtils.pyo", line 21, in <module>
File "scipy\__init__.pyo", line 61, in <module>
File "numpy\__init__.pyo", line 180, in <module>
File "numpy\add_newdocs.pyo", line 13, in <module>
File "numpy\lib\__init__.pyo", line 8, in <module>
File "numpy\lib\type_check.pyo", line 11, in <module>
File "numpy\core\__init__.pyo", line 23, in <module>
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
cannot import name py31compat
I've tried upgrading setuptools and distribute with pip, which did not help.
I've looked in the executables LIB file, and the pkg_resources has py31compat.pyo in it, which as far as I've been able to determine is where it should be.
I don't know how to figure out where the multiarray.pyd is trying to load it from.

Tensorflow 1.7- Windows- No module named pywrap

I know people asked this question before. I believe I tried everything written in other StackOverflow questions (On Windows, running "import tensorflow" generates No module named "_pywrap_tensorflow" error). The new TensorFlow 1.7 requires CUDA Toolkit 9.0 and cuDNN v7.0 (both of which I added to my environment path). I also installed the latest version of Visual Studio 17. I reinstalled Python 3.5; Anaconda; CUDA Toolkit 9.0; cuDNN v7.0. Do you think its because of the new VS studio isn't compatible?
This is the error I get:
import tensorflow as tf
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import * # pylint: disable=redefined-builtin
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
This error might be caused because of generation of your processor. I struggled with the same error for CPU mode only. Checked for 2 machines: win 7 pro, i7 1366 socket and win 7 home with i5 1366 socket with the same output.
The problem is that Tensorflow r1.7 seems to require AVX support. Check does your processor support AVX if not switch to Tensor Flow 1.5
For native instalation (python 3.5 or python 3.6)(Tensor Flow r1.5 CPU)
pip3 install tensorflow==1.5
For anaconda (Tensor Flow r1.5 CPU)
conda create -n your_env_name pip python=3.5 (or 3.6)
in next line
activate your_env_name
and finally install Tensorflow 1.5
pip install --ignore-installed tensorflow==1.5
For me two ways work on 2 machines without problems.
I have no idea if you are dealing with GPU because I am new and my graphics is not powerfull enough to use.
Enjoy!

Trouble importing numba

Ok, I'm using python 3.3. I have numpy, llvm, llvmpy, llpyhton, llvm_array, llvm_cbuilder and llvmath installed. I have also installed numba.
However, when trying to import via import numba, the following error appears. I have no idea of what could be missing:
Traceback (most recent call last):
File "/home/pablo/workspace/Pruebas/src/Prueba2/__init__.py", line 1, in <module>
import numba
File "/usr/local/lib/python3.3/dist-packages/numba/__init__.py", line 18, in <module>
from numba import utils, typesystem
File "/usr/local/lib/python3.3/dist-packages/numba/utils.py", line 102, in <module>
context = get_minivect_context()
File "/usr/local/lib/python3.3/dist-packages/numba/utils.py", line 100, in get_minivect_context
return NumbaContext()
File "/usr/local/lib/python3.3/dist-packages/numba/minivect/miniast.py", line 138, in __init__
import llvm.core as llvm_py_not_available # llvm-py not available
File "/usr/local/lib/python3.3/dist-packages/llvm/__init__.py", line 6, in <module>
from llvmpy import extra
File "/usr/local/lib/python3.3/dist-packages/llvmpy/extra.py", line 6, in <module>
from llvmpy import _api
ImportError: libLLVM-3.2.so: cannot open shared object file: No such file or directory
Any ideas?
Ok, I found out what was wrong.
I added the anaconda folders to the deafault python3 interpreter, instead of installing numba directly in the packages folder.

Categories

Resources