472,133 Members | 1,090 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,133 software developers and data experts.

OpenOpt install

What do I need to do? I have numpy, scipy (Fedora F8)

cd openopt/
[nbecker@nbecker1 openopt]$ python setup.py build
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_py
creating build
creating build/lib
creating build/lib/scikits
copying scikits/__init__.py -build/lib/scikits
creating build/lib/scikits/openopt
copying scikits/openopt/__init__.py -build/lib/scikits/openopt
copying scikits/openopt/info.py -build/lib/scikits/openopt
copying scikits/openopt/oo.py -build/lib/scikits/openopt
Traceback (most recent call last):
File "setup.py", line 101, in <module>
import scikits
ImportError: No module named scikits

Dec 16 '07 #1
5 2759
Use
python setup.py install

Regards, D

On Dec 16, 2:27 pm, Neal Becker <ndbeck...@gmail.comwrote:
What do I need to do? I have numpy, scipy (Fedora F8)

cdopenopt/
[nbecker@nbecker1openopt]$ python setup.py build
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_py
creating build
creating build/lib
creating build/lib/scikits
copying scikits/__init__.py -build/lib/scikits
creating build/lib/scikits/openopt
copying scikits/openopt/__init__.py -build/lib/scikits/openopt
copying scikits/openopt/info.py -build/lib/scikits/openopt
copying scikits/openopt/oo.py -build/lib/scikits/openopt
Traceback (most recent call last):
File "setup.py", line 101, in <module>
import scikits
ImportError: No module named scikits
Dec 17 '07 #2
dmitrey wrote:
Use
python setup.py install
People should be able to run the distutils commands independently.

What are you trying to achieve with this block of code that follows the setup()
call?

new_name = 'tmp55'
os.rename('scikits', new_name)
newPath = []
for directory in sys.path:
if not 'scikits' in directory: newPath.append(directory)# something
wrong with list.remove()
sys.path = newPath
import scikits
reload(scikits)
Path = scikits.__path__[0]
NewPath = os.path.join(Path, 'openopt')
rmtree(NewPath, True) # True means ignore errors
copytree(os.path.join(os.path.curdir, new_name, 'openopt'), NewPath)
NewPath = Path
compileall.compile_dir(NewPath)

os.rename(new_name, 'scikits')
This just looks like a really bad idea.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Dec 17 '07 #3
When earlier OpenOpt versions had been installed there were no
compiled pyc-files (in destination directory). I called to mailing
list but no obvious receipt had been achieved. Matthieu had done some
changes but it yielded other mistakes (no some py-files detected or
kind of), so I had removed those changes and write my own, for to have
OO py-files being compiled when installed, because next time when they
will be run user may not have root permissions, so he will recompile
source files each time OO starts.

On Dec 17, 10:27 pm, Robert Kern <robert.k...@gmail.comwrote:
dmitrey wrote:
Use
python setup.py install

People should be able to run the distutils commands independently.

What are you trying to achieve with this block of code that follows the setup()
call?

new_name = 'tmp55'
os.rename('scikits', new_name)
newPath = []
for directory in sys.path:
if not 'scikits' in directory: newPath.append(directory)# something
wrong with list.remove()
sys.path = newPath
import scikits
reload(scikits)
Path = scikits.__path__[0]
NewPath = os.path.join(Path, 'openopt')
rmtree(NewPath, True) # True means ignore errors
copytree(os.path.join(os.path.curdir, new_name, 'openopt'), NewPath)
NewPath = Path
compileall.compile_dir(NewPath)

os.rename(new_name, 'scikits')

This just looks like a really bad idea.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
Dec 18 '07 #4
dmitrey wrote:
When earlier OpenOpt versions had been installed there were no
compiled pyc-files (in destination directory). I called to mailing
list but no obvious receipt had been achieved. Matthieu had done some
changes but it yielded other mistakes (no some py-files detected or
kind of), so I had removed those changes and write my own, for to have
OO py-files being compiled when installed, because next time when they
will be run user may not have root permissions, so he will recompile
source files each time OO starts.
Well, the problem there is that you have put code into subdirectories that
aren't packages. Then you manually add the directories to sys.path when you
import scikits.openopt.oo . This is a bad thing to do for several reasons; one
reason is that you don't get the correct .pyc files.

You need to make the directory structure match the package structure. For
example, you currently have the module scikits.openopt.LP in
scikits/openopt/Kernel/LP/LP.py . You have two options:

* you can make the directory structure match the package structure by moving
the files to the correct location:

$ mv scikits/openopt/Kernel/LP/LP.py scikits/openopt/LP.py

* you can make the package structure match the directory structure by adding
__init__.py files to the subdirectories and changing the imports to match:

$ touch scikits/openopt/Kernel/__init__.py
$ touch scikits/openopt/Kernel/LP/__init__.py
$ vim scikits/openopt/oo.py
# 1. Delete the sys.path munging.
# 2. Change "from LP import LP as CLP" to "from Kernel.LP import LP as CLP"

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Dec 18 '07 #5
thank you, I'll try to fix the issue when I'll have more time, I'm
short of the one for now because of some other urgent work.
D.

On Dec 18, 10:53 am, Robert Kern <robert.k...@gmail.comwrote:
dmitrey wrote:
When earlier OpenOpt versions had been installed there were no
compiled pyc-files (in destination directory). I called to mailing
list but no obvious receipt had been achieved. Matthieu had done some
changes but it yielded other mistakes (no some py-files detected or
kind of), so I had removed those changes and write my own, for to have
OO py-files being compiled when installed, because next time when they
will be run user may not have root permissions, so he will recompile
source files each time OO starts.

Well, the problem there is that you have put code into subdirectories that
aren't packages. Then you manually add the directories to sys.path when you
import scikits.openopt.oo . This is a bad thing to do for several reasons; one
reason is that you don't get the correct .pyc files.

You need to make the directory structure match the package structure. For
example, you currently have the module scikits.openopt.LP in
scikits/openopt/Kernel/LP/LP.py . You have two options:

* you can make the directory structure match the package structure by moving
the files to the correct location:

$ mv scikits/openopt/Kernel/LP/LP.py scikits/openopt/LP.py

* you can make the package structure match the directory structure by adding
__init__.py files to the subdirectories and changing the imports to match:

$ touch scikits/openopt/Kernel/__init__.py
$ touch scikits/openopt/Kernel/LP/__init__.py
$ vim scikits/openopt/oo.py
# 1. Delete the sys.path munging.
# 2. Change "from LP import LP as CLP" to "from Kernel.LP import LP as CLP"

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
Dec 18 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Yun Guan | last post: by
1 post views Thread by Peter Hartmann | last post: by
3 posts views Thread by Henry Reardon | last post: by
3 posts views Thread by Jeremy S. | last post: by
7 posts views Thread by p | last post: by
1 post views Thread by Sorin Schwimmer | last post: by
1 post views Thread by =?Utf-8?B?Qi5BaGxzdGVkdA==?= | last post: by
3 posts views Thread by Jean-Marc Blaise | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.