Octave imread bmp file - matlab

I need to read a file myFile.bmp in Octave but it doesn't work.
I have:
Ubuntu 15.04
Ocatve 3.8.2
ImageMagick 8:6.8.9.9-5
When I run imread('myFile.bmp'), I get this:
octave:10> imread ("myFile.bmp")
error: imread: invalid image file: /usr/lib/x86_64-linux-gnu/octave/3.8.2/oct/x86_64-pc-linux-gnu/__magick_read__.oct: failed to load: /usr/lib/x86_64-linux-gnu/octave/3.8.2/oct/x86_64-pc-linux-gnu/__magick_read__.oct: undefined symbol: _ZN6Magick5ColorC1Ehhh
error: called from:
error: /usr/share/octave/3.8.2/m/image/private/__imread__.m at line 181, column 7
error: /usr/share/octave/3.8.2/m/image/private/imageIO.m at line 66, column 26
error: /usr/share/octave/3.8.2/m/image/imread.m at line 107, column 30
When I run imread('myFile.bmp', 'Format', 'bmp'), I get the same error.

If you installed everything from the Ubuntu repositories, then you are probably affected by an Ubuntu packaging issue. It was described in comment #6 of Ubuntu bug #1372202.
Since Ubuntu 15.04 has already reached end of life, they probably won't fix it. You can:
upgrade Ubuntu
build Octave from source yourself

Related

How do I solve this issue?

I tried to install a package in command prompt (actin) from python.but always there is an error. I tried to solve this issue but I could not.
The package is (Actin) to calculate the indices in science.
this is an error:
This is what I do:
C:\Users\MAISSA>**\pip install actin
Collecting actin
Using cached actin-1.3.6.tar.gz (52.0 MB)
ERROR: Could not install packages due to an OSError: [Errno 22]
Invalid argument: 'C:\Users\MAISSA\AppData\Local\Temp\pip-install-ysinw5a9\actin_8d5ed7c1aad943cbba7a60ea2545108f\actin/test_files/2010-09-18T23:42:36.178_spec.rdb
The Python OSError: [Errno 22] Invalid argument problem occurs,1.The file path is faulty(The file path does not exist, or the string is inconsistent with the file path) 2.When there are strange characters in front of the path,You should have thought it was because of coding(Whether it's ANSI coding or UTF-8 coding or some other coding reason)

Anaconda 3 throwing error when installed in Linux Mint 19

I had a previous version of Anaconda 2 (working with Python 2.7), which I uninstalled to newly install Anaconda 3 (to work with Python 3.x).
While the previous Anaconda 2 was working fine, the newly installed Anaconda 3 throws the following error:
Traceback (most recent call last):
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/widgets/main_window.py", line 541, in setup
self.post_setup(conda_data=conda_data)
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/widgets/main_window.py", line 578, in post_setup
self.tab_home.setup(conda_data)
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/widgets/tabs/home.py", line 169, in setup
self.set_applications(applications, packages)
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/widgets/tabs/home.py", line 204, in set_applications
apps = self.api.process_apps(applications, prefix=self.current_prefix)
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/api/anaconda_api.py", line 848, in process_apps
app = app(config=self.config, process_api=self._process_api, conda_api=self._conda_api)
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/api/external_apps/vscode.py", line 48, in __init__
**kwargs
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/api/external_apps/base.py", line 43, in __init__
self.init()
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/api/external_apps/base.py", line 60, in init
SUBDIR, INST_EXT, INST_DIR = self._find_linux_install_dir()
File "/home/partha/anaconda3/lib/python3.7/site-packages/anaconda_navigator/api/external_apps/vscode.py", line 168, in _find_linux_install_dir
if DISTRO_NAME in ['ubuntu', 'debian']:
UnboundLocalError: local variable 'DISTRO_NAME' referenced before assignment
Any help to get started with the new installation will be much appreciated.
I am using Linux Mint 19 with the following info:
...$ cat /etc/linuxmint/info
RELEASE=19
CODENAME=tara
EDITION="Xfce"
DESCRIPTION="Linux Mint 19 Tara"
DESKTOP=Gnome
TOOLKIT=GTK
NEW_FEATURES_URL=http://www.linuxmint.com/rel_tara_xfce_whatsnew.php
RELEASE_NOTES_URL=http://www.linuxmint.com/rel_tara_xfce.php
USER_GUIDE_URL=help:linuxmint
GRUB_TITLE=Linux Mint 19 Xfce
...$
A quick google search showed that an issue was open about your problems few days ago in github
Fortunately a workaround was posted:
Editing the file: ".../anaconda3//lib/python3.7/site-packages/anaconda_navigator/api/external_apps/vscode.py"
By declaring the variable outside the loop.
Just add the line:
DISTRO_NAME = None
on Line 159 and indent it in line with the if above it (Outside it)
I got a similar experience this morning. But I was able to resolve mine by typing this into my command-line interface(CLI).
conda update anaconda-navigator
I hope this work for you.

pkg load sockets with octave

I have installed octave on Ubuntu 16.04 originally without the ppa (version 4.0.0), but the problem remains with the ppa (version 4.0.2).
To install it, I have runned : sudo apt install octave octave-sockets and it went fine.
But when I am in octave-cli and I run this command: pkg load sockets. I have the following error:
error: __which__: /usr/lib/x86_64-linux-gnu/octave/packages/sockets-1.2.0/x86_64-pc-linux-gnu-api-v50+/socket.oct: failed to load: /usr/lib/x86_64-linux-gnu/octave/packages/sockets-1.2.0/x86_64-pc-linux-gnu-api-v50+/socket.oct: undefined symbol: _ZNK5ArrayISsE17resize_fill_valueEv
error: called from
which at line 31 column 7
/usr/lib/x86_64-linux-gnu/octave/packages/sockets-1.2.0/x86_64-pc-linux-gnu-api-v50+/PKG_ADD at line 2 column 1
load_packages_and_dependencies at line 47 column 5
load_packages at line 60 column 3
pkg at line 422 column 7
error: evaluating argument list element number 2
error: called from
/usr/lib/x86_64-linux-gnu/octave/packages/sockets-1.2.0/x86_64-pc-linux-gnu-api-v50+/PKG_ADD at line 2 column 1
load_packages_and_dependencies at line 47 column 5
load_packages at line 60 column 3
pkg at line 422 column 7
So I am supposing that the package octave-sockets is missing a dependency but I don't find which one. If you can help me with that... Thank you very much!
Rather than using Ubuntu's packaged octave-sockets package, you're likely to have a better experience if you install the package directly from Octave instead
pkg install -forge sockets

iptest3 with IPython

I'm brand new to Python programming and trying to get myself a functional base from which I can run things like the IPython Notebook which looks pretty exciting.
Thus far I have both Python 2.7 and 3.3 from python.org installed in OS X 10.6 (Snow Leopard) as well as ActiveTcl 8.5.13. Almost everything that I've tried thus far works as expected. I'm focused on learning 3.3, but want to have the option of using 2.7 too. I read up in several documents that I need to start gaining access to PyPI packages using a Python package manager and that distribute is the one I should use for 3k. So I installed that according to the documentation I found and it seemed to work fine.
I also installed pip as directed, and a number of others.
At this point, I have:
$ pip freeze
distribute==0.6.34
ipython==0.13.1
nose==1.2.1 (installed after IPython)
pexpect==2.4 (installed after IPython)
pyflakes3k==0.4.3
readline==6.2.4.1 (installed after IPython)
At this point, I'm doing this from ipython.org guidance
And when I did $ easy_install pexpect, I got a bunch of errors:
$ easy_install pexpect
Searching for pexpect
Reading http://pypi.python.org/simple/pexpect/
Reading http://pexpect.sourceforge.net/
Reading http://sourceforge.net/project/showfiles.php?group_id=59762
Best match: pexpect 2.4
Downloading http://pypi.python.org/packages/source/p/pexpect/pexpect-2.4.tar.gz#md5=fe82d69be19ec96d3a6650af947d5665
Processing pexpect-2.4.tar.gz
Writing /var/folders/td/td0Sh8EfGFuMCnKex1v+q++++TI/-Tmp-/easy_install-s4dtyy/pexpect-2.4/setup.cfg
Running pexpect-2.4/setup.py -q bdist_egg --dist-dir /var/folders/td/td0Sh8EfGFuMCnKex1v+q++++TI/-Tmp-/easy_install-s4dtyy/pexpect-2.4/egg-dist-tmp-5h5cg4
File "build/bdist.macosx-10.6-intel/egg/fdpexpect.py", line 36
raise ExceptionPexpect, 'The fd argument is not a valid file descriptor.'
^
SyntaxError: invalid syntax
File "build/bdist.macosx-10.6-intel/egg/FSM.py", line 77
return `self.value`
^
SyntaxError: invalid syntax
File "build/bdist.macosx-10.6-intel/egg/pexpect.py", line 82
except ImportError, e:
^
SyntaxError: invalid syntax
zip_safe flag not set; analyzing archive contents...
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pexpect-2.4-py3.3.egg/fdpexpect.py", line 36
raise ExceptionPexpect, 'The fd argument is not a valid file descriptor.'
^
SyntaxError: invalid syntax
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pexpect-2.4-py3.3.egg/FSM.py", line 77
return `self.value`
^
SyntaxError: invalid syntax
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pexpect-2.4-py3.3.egg/pexpect.py", line 82
except ImportError, e:
^
SyntaxError: invalid syntax
Adding pexpect 2.4 to easy-install.pth file
Installed /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pexpect-2.4-py3.3.egg
Processing dependencies for pexpect
Finished processing dependencies for pexpect
That looks bad to me (although I don't yet have the expertise to really interpret it), and so I'm not sure if I have a complete install of pexpect.
After installing nose (before pexpect as per URL above), I tried running iptest and iptest3 from the command line, and both failed to find the command, but after I did easy_install ipython again (after nose), I noticed that this install added iptest3 (as well as ipcluster3 and a few other scripts) to my path, and now my bash shell can find iptest3, but when I run it, I get some more bad-looking output:
$ iptest3
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.3/bin/iptest3", line 9, in <module>
load_entry_point('ipython==0.13.1', 'console_scripts', 'iptest3')()
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/distribute-0.6.34-py3.3.egg/pkg_resources.py", line 343, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/distribute-0.6.34-py3.3.egg/pkg_resources.py", line 2308, in load_entry_point
return ep.load()
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/distribute-0.6.34-py3.3.egg/pkg_resources.py", line 2014, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/IPython/__init__.py", line 43, in <module>
from .config.loader import Config
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/IPython/config/__init__.py", line 16, in <module>
from .application import *
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/IPython/config/application.py", line 31, in <module>
from IPython.config.configurable import SingletonConfigurable
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/IPython/config/configurable.py", line 26, in <module>
from .loader import Config
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/IPython/config/loader.py", line 27, in <module>
from IPython.utils.path import filefind, get_ipython_dir
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/IPython/utils/path.py", line 25, in <module>
from IPython.utils.process import system
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/IPython/utils/process.py", line 27, in <module>
from ._process_posix import _find_cmd, system, getoutput, arg_split
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/IPython/utils/_process_posix.py", line 22, in <module>
from IPython.external import pexpect
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/IPython/external/pexpect/__init__.py", line 2, in <module>
import pexpect
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pexpect-2.4-py3.3.egg/pexpect.py", line 82
except ImportError, e:
^
SyntaxError: invalid syntax
After doing all that, I noted that my /Library/Frameworks/Python.framework/Versions/Current had been pointing to 2.7, and I guessed that that might be related to my problems and changed the symbolic link to point to 3.3, but iptest3 still fails with the error above.
Any other thoughts on what to do to fix this? It's clear that iptest is pretty important to doing anything else (like IPython Notebook) I want to do.
There is a py3-compatible fork of pexpect called pexpect-u (the u is for unicode, the main difference between the two). You need this to run the pexpect-based parts of IPython on Python 3.
Should be a simple
pip install pexpect-u
side note: pexpect-u is by IPython developer Thomas Kluyver, who did most of the heavy lifting bringing py3 compatibility to IPython.

Converting MATLAB files to Octave

I have a series of experiments that were written for MATLAB, but recently we are trying to run them through Octave instead. I realize they are mostly compatible, but I have been running into a few problems, and none of the online FAQs or directions I have found have addressed these at all. It's complicated a bit because there are multiple .m files that interact; however, for now I am going to focus on the main program. Anyway, so when I try to run the file (MLP.m) through octave, I get the following errors in the Terminal window:
error: dir: expecting directory or filename to be a char array
error: called from:
error: /Applications/Octave.app/Contents/Resources/share/octave/3.2.3/m/miscellaneous/dir.m at line 128, column 5
error: /Applications/MATLAB_R2008a/toolbox/psychoacoustics/MLParameters.m at line 86, column 7
error: /Applications/MATLAB_R2008a/toolbox/psychoacoustics/MLP.m at line 9, column 3
The lines it is referencing are as follows:
1)
d = dir([cd myslash 'Experiments_MLP' myslash '*.m']);
2)
s = MLParameters;
What about these lines is incompatible with Octave? I can't find anything online that indicates that these won't work.
After that, the Terminal window gives me this batch of nonsense:
dyld: Library not loaded: /usr/X11/lib/libfreetype.6.dylib
Referenced from: /usr/X11R6/lib/libfontconfig.1.dylib
Reason: Incompatible library version: libfontconfig.1.dylib requires version 13.0.0 or later, but libfreetype.6.dylib provides version 10.0.0
dyld: Library not loaded: /usr/X11/lib/libfreetype.6.dylib
Referenced from: /usr/X11R6/lib/libfontconfig.1.dylib
Reason: Incompatible library version: libfontconfig.1.dylib requires version 13.0.0 or later, but libfreetype.6.dylib provides version 10.0.0
/Applications/Gnuplot.app/Contents/Resources/bin/gnuplot: line 71: 1077 Trace/BPT trap GNUTERM="${GNUTERM}" GNUPLOT_HOME="${GNUPLOT_HOME}" PATH="${PATH}" DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}" HOME="${HOME}" GNUHELP="${GNUHELP}" DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}" GNUPLOT_PS_DIR="${GNUPLOT_PS_DIR}" DISPLAY="${DISPLAY}" GNUPLOT_DRIVER_DIR="${GNUPLOT_DRIVER_DIR}" "${ROOT}/bin/gnuplot-4.2.6" "$#"
/Applications/Gnuplot.app/Contents/Resources/bin/gnuplot: line 71: 1083 Trace/BPT trap GNUTERM="${GNUTERM}" GNUPLOT_HOME="${GNUPLOT_HOME}" PATH="${PATH}" DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}" HOME="${HOME}" GNUHELP="${GNUHELP}" DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}" GNUPLOT_PS_DIR="${GNUPLOT_PS_DIR}" DISPLAY="${DISPLAY}" GNUPLOT_DRIVER_DIR="${GNUPLOT_DRIVER_DIR}" "${ROOT}/bin/gnuplot-4.2.6" "$#"
error: you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function
I have GNUPlot installed, and I checked the gnuplot_binary function, which didn't give me any answers. GNUPlot is installed in my /Applications directory, along with Octave itself. Why shouldn't this work? The README file that came with GNUPlot didn't indicate a special directory for it to be installed in. What about the the dyld library not loaded errors? Is that related to the GNUPlot problem, or is it something else?
Anyway, thanks for your help
I know you already solved your problem, but if you have problems again here are some links with basic information about the differences between Matlab and Octave:
Porting programs from Matlab to Octave
Differences between Octave and MATLAB
Addressing your first error, it's easier to explain with an example:
dirName = '/some/path'; %# base directory
filesPath = fullfile(dirName, 'MLP', '*.m'); %# full path string
d = dir(filesPath); %# expand/enumerate files
for i=1:numel(d)
disp( d(i).name )
end
You also could have built the path using string concatenation yourself:
%# '/some/path/MLP/*.m'
filesPath = [dirName filesep 'MLP' filesep '*.m'];
The above should work for both MATLAB and Octave