I am trying to solve a problem with pyomo (solver=ipopt). I have installed Anaconda in Windows10.
When I run it from spyder I get:
Solver log file: 'C:\Users\MC\AppData\Local\Temp\tmp3ba3l1v5_ipopt.log'
Solver solution file: 'C:\Users\MC\AppData\Local\Temp\tmpf_uhkuem.pyomo.sol'
Solver problem files: ('C:\\Users\\MC\\AppData\\Local\\Temp\\tmpf_uhkuem.pyomo.nl',)
Exception in thread Thread-7:
Traceback (most recent call last):
File "C:\Users\MC\Anaconda3\lib\threading.py", line 914, in _bootstrap_inner
self.run()
File "C:\Users\MC\Anaconda3\lib\threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\MC\Anaconda3\lib\site-packages\pyutilib\subprocess\processmngr.py", line 292, in _merged_reader
encoding = sys.__stdout__.encoding
AttributeError: 'NoneType' object has no attribute 'encoding'
However, running the same problem from the command prompt I get the correct solution, the graphics, etc.
Any idea?
Related
My program is supposed to open a docx file 'Core.docx' with python-docx and does it just fine until I make an executable out of it with pyinstaller. I got the same error doing this on Windows 10 but was able to fix it by manually copying 'Core.docx' into the dist folder. On Mac, it doesn't solve it.
Error:
Traceback (most recent call last):
File "script.py", line 13, in <module>
File "docx/api.py", line 25, in Document
File "docx/opc/package.py", line 128, in open
File "docx/opc/pkgreader.py", line 32, in from_file
File "docx/opc/phys_pkg.py", line 30, in __new__
docx.opc.exceptions.PackageNotFoundError: Package not found at 'Core.docx'
[7946] Failed to execute script 'script' due to unhandled exception!
I've also tried the function --add-data after reading this exchange:
pyinstaller -F --add-data "Core.docx:Core.docx" script.py
It ran but nothing seems to have actually changed.
Does anyone know of any solutions?
I am trying to install geopandas and have therefore downloaded anaconda. However the anaconda prompt gives back an error when I try the command "conda install geopandas" (Installing geopandas with anaconda prompt causes ImportError). I discovered that conda won't install any package, nor will it create new environments. And, as it happens, will not even work for "conda info" (see below error report).
Looking through help suggestions on the internet I added both "C:\Users\Name\anaconda3" and "C:\Users\Name\anaconda3\Scripts" to the PATH System environment variable but it didn't resolve the issue.
Any help would be greatly appreciated.
>>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "C:\Users\Francesco\anaconda3\lib\site-packages\conda\exceptions.py", line 1079, in __call__
return func(*args, **kwargs)
File "C:\Users\Francesco\anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main
exit_code = do_call(args, p)
File "C:\Users\Francesco\anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 83, in do_call
return getattr(module, func_name)(args, parser)
File "C:\Users\Francesco\anaconda3\lib\site-packages\conda\cli\main_info.py", line 316, in execute
info_dict = get_info_dict(args.system)
File "C:\Users\Francesco\anaconda3\lib\site-packages\conda\cli\main_info.py", line 164, in get_info_dict
pkgs_dirs=context.pkgs_dirs,
File "C:\Users\Francesco\anaconda3\lib\site-packages\conda\base\context.py", line 520, in pkgs_dirs
fixed_dirs += user_data_dir(APP_NAME, APP_NAME),
File "C:\Users\Francesco\anaconda3\lib\site-packages\conda\_vendor\appdirs.py", line 67, in user_data_dir
path = os.path.join(_get_win_folder(const), appauthor, appname)
File "C:\Users\Francesco\anaconda3\lib\site-packages\conda\_vendor\appdirs.py", line 284, in _get_win_folder_with_pywin32
from win32com.shell import shellcon, shell
ImportError: DLL load failed while importing shell: The specified module could not be found.
$ C:\Users\Francesco\anaconda3\Scripts\conda-script.py info
'''
I've experienced pretty much the same problem. I was able to narrow down the issue to pywin32 version 302.
Using version 301 worked for me.
Try: pip install pywin32==301 --force
See https://github.com/mhammond/pywin32/issues/1783
I have a following problem. I am not able to run anaconda navigator, neither anaconda-prompt after anaconda3 installation.
Nothing happens when I click on anaconda-navigator.exe as saved in C:\Users\misak\anaconda3\Scripts. When I check environmental variables paths I have there C:\Users\misak\anaconda3\Scripts.
When I try to run anaconda navigator from cmd I get this error:
C:\Users\misak>anaconda-navigator
Traceback (most recent call last):
File "C:\Users\misak\anaconda3\lib\site-packages\qtpy\__init__.py", line 204, in <module>
from PySide import __version__ as PYSIDE_VERSION # analysis:ignore
ModuleNotFoundError: No module named 'PySide'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\misak\anaconda3\Scripts\anaconda-navigator-script.py", line 6, in <module>
from anaconda_navigator.app.main import main
File "C:\Users\misak\anaconda3\lib\site-packages\anaconda_navigator\app\main.py", line 22, in <module>
from anaconda_navigator.utils.conda import is_conda_available
File "C:\Users\misak\anaconda3\lib\site-packages\anaconda_navigator\utils\__init__.py", line 15, in <module>
from qtpy.QtGui import QIcon
File "C:\Users\misak\anaconda3\lib\site-packages\qtpy\__init__.py", line 210, in <module>
raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found
I tried to reinstall Anaconda many times, co the problem seems to be somewhere else. Can you help my please?
I am a complete code novice. I am trying to teach myself python and so far I've been able to do rudimentary scripting. I want to try and learn how to use an OCR which might be somewhat advanced for me, but I'm doing it for fun so I have all the time in the world.
I'm trying to set up pytesser and I understand I need to download both the pytesser module and a PIL. I think there is a problem with how I'm storing my files.
Right now my PIL directory is located in:
C:\Python27\Lib\site-packages
and my pytesser_v0.01 directory is located in:C:\Python27\Lib\site-packages
I try to do the basic test found here
And I keep getting the following error
>>> from pytesser import*
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pytesser
I think this is a very simple question because I keep looking to where to install my PIL and pytesser directories and every online forum/help starts by saying "install it" and not where.
Edit:
I found the correct place to install pytesser but now i'm getting the following errors. The first problem was solved by making sure that pytesser, util, errors and tesseract.exe were in the site-package file and the program didn't have to go into the pytesser folder.
>>> image = Image.open('fnord.tif')
>>> print image_to_string(image)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\pytesser.py", line 30, in image_to_string
util.image_to_scratch(im, scratch_image_name)
File "C:\Python27\lib\site-packages\util.py", line 7, in image_to_scratch
im.save(scratch_image_name, dpi=(200,200))
File "C:\Python27\lib\site-packages\PIL\Image.py", line 1433, in save
fp = __builtin__.open(fp, "wb")
IOError: [Errno 13] Permission denied: 'temp.bmp'
I've got a MacBook (Mac OS X 10.9) with 16 Gb of RAM.
Two Pythons installed via Anaconda: 2.7.8 and 3.4.1. Both equipped with the latest scikit-learn 0.15.1.
While trying to run that simple code (just testing the possibility to serialize large matrixes):
import numpy as np
test_data = np.random.rand(10000, 60000)
print(test_data.nbytes / 2**30)
from sklearn.externals import joblib
joblib.dump(test_data, '/Users/va/Desktop/test_data.joblib')
Python 2.7.8 is doing well, but Python 3.4.1 stuck with the following error:
Failed to save <class 'numpy.ndarray'> to .npy file:
Traceback (most recent call last):
File "/Users/va/anaconda/python.app/Contents/lib/python3.4/site-
packages/sklearn/externals/joblib/numpy_pickle.py", line 240, in save
obj, filename = self._write_array(obj, filename)
File "/Users/va/anaconda/python.app/Contents/lib/python3.4/site-
packages/sklearn/externals/joblib/numpy_pickle.py", line 203, in _write_array
self.np.save(filename, array)
File "/Users/va/anaconda/python.app/Contents/lib/python3.4/site-
packages/numpy/lib/npyio.py", line 453, in save
format.write_array(fid, arr)
File "/Users/va/anaconda/python.app/Contents/lib/python3.4/site-
packages/numpy/lib/format.py", line 410, in write_array
fp.write(array.tostring('C'))
OSError: [Errno 22] Invalid argument
Traceback (most recent call last):
File "<ipython-input-3-90ed09e5c6d4>", line 1, in <module>
joblib.dump(test_data, '/Users/va/Desktop/test_data.joblib')
File "/Users/va/anaconda/python.app/Contents/lib/python3.4/site-
packages/sklearn/externals/joblib/numpy_pickle.py", line 368, in dump
pickler.dump(value)
File "/Users/va/anaconda/python.app/Contents/lib/python3.4/pickle.py", line 412, in dump
self.framer.end_framing()
File "/Users/va/anaconda/python.app/Contents/lib/python3.4/pickle.py", line 196, in end_framing
self.commit_frame(force=True)
File "/Users/va/anaconda/python.app/Contents/lib/python3.4/pickle.py", line 208, in commit_frame
write(data)
OSError: [Errno 22] Invalid argument
It appears the problem is in the amount of data to be stored. E.g., Python 3 handles np.random.rand(10000, 20000), which is 1.5 Gb, perfectly well.
Just in case, pickle didn't work as well:
import pickle
with open('/Users/va/Desktop/test_data.pkl', 'wb') as f:
pickle.dump(test_data, f, protocol=pickle.HIGHEST_PROTOCOL)
goes to:
Traceback (most recent call last):
File "<ipython-input-6-3f73f3011539>", line 3, in <module>
pickle.dump(test_data, f, protocol=pickle.HIGHEST_PROTOCOL)
OSError: [Errno 22] Invalid argument
On Windows 7 Python 3.4 works fine with both joblib and pickle.
Any suggestions how to solve that problem with Python 3 on Mac?
This happens to me on OS X 10.10 with Python 3.4.3 using pickle too
Instead I started using https://github.com/zopefoundation/zodbpickle, which is around 2-3 times slower, but definitely works with sklearn classifiers