Comments (11)
I renamed folder to build/win-amd64-cpython-39
and it worked. Thanks! Will you include the keys for gcc in installation guide?
from cpymad.
Hi, this says that the MAD-X source code couldn't be found. When building from source, you have to build MAD-X first. Did you look at the installation/build instructions?
from cpymad.
Hi, @coldfix. Yes, I've read the instructions. When I follow them I encounter a problem.
Execution of
call %gcc% -mdll -O -Wall ^
-I %MADXDIR%\include ^
-I %pythondir%\include ^
-c src/cpymad/libmadx.c ^
-o %tempdir%\libmadx.obj ^
-std=gnu99
gives me the following error
src/cpymad/libmadx.c:250:41: warning: division by zero [-Wdiv-by-zero]
enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
^
src/cpymad/libmadx.c:250:12: error: enumerator value for '__pyx_check_sizeof_voidp' is not an integer constant
enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
I'm trying to build cpymad for python 3.9.
from cpymad.
Before I posted this I was trying to install cpymad via
pip install cpymad --only-binary cpymad
But runnig madx in jupyther gave me this:
from cpymad.madx import Madx
madx = Madx()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [1], in <cell line: 2>()
1 from cpymad.madx import Madx
----> 2 madx = Madx()
File ~\Anaconda3\lib\site-packages\cpymad\madx.py:192, in Madx.__init__(self, libmadx, command_log, stdout, history, prompt, **Popen_args)
190 if not libmadx.is_started():
191 with self.reader:
--> 192 libmadx.start()
193 # init instance variables:
194 self.history = history
File ~\Anaconda3\lib\site-packages\cpymad\stream.py:57, in AsyncReader.__exit__(self, *exc_info)
55 output_lines = self.result.get()
56 if output_lines:
---> 57 self.callback(b''.join(output_lines))
File ~\Anaconda3\lib\site-packages\ipykernel\iostream.py:513, in OutStream.write(self, string)
503 """Write to current stream after encoding if necessary
504
505 Returns
(...)
509
510 """
512 if not isinstance(string, str):
--> 513 raise TypeError(
514 f"write() argument must be str, not {type(string)}"
515 )
517 if self.echo is not None:
518 try:
TypeError: write() argument must be str, not <class 'bytes'>
So I was thinking there was something wrong with installation. I bypassed this issue typing
madx = Madx(stdout=False)
Is there a proper way to fix that issue so the output would be seen in jupyter?
from cpymad.
Hi, @coldfix. Yes, I've read the instructions. When I follow them I encounter a problem. Execution of
call %gcc% -mdll -O -Wall ^ -I %MADXDIR%\include ^ -I %pythondir%\include ^ -c src/cpymad/libmadx.c ^ -o %tempdir%\libmadx.obj ^ -std=gnu99
gives me the following error
src/cpymad/libmadx.c:250:41: warning: division by zero [-Wdiv-by-zero]
enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
^
src/cpymad/libmadx.c:250:12: error: enumerator value for '__pyx_check_sizeof_voidp' is not an integer constant
enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };I'm trying to build cpymad for python 3.9.
Can you try adding -DMS_WIN64
to that command line, i.e.:
call %gcc% -mdll -O -Wall -DMS_WIN64 ^
-I %MADXDIR%\include ^
-I %pythondir%\include ^
-c src/cpymad/libmadx.c ^
-o %tempdir%\libmadx.obj ^
-std=gnu99
If it doesn't work, please show the complete workflow from setting up a fresh environment up to getting this error.
from cpymad.
Before I posted this I was trying to install cpymad via
pip install cpymad --only-binary cpymad
Yeah, sorry, I haven't been very active recently. Let's keep this in its own issue though.
from cpymad.
Can you try adding
-DMS_WIN64
to that command line
I have and it probably worked - no warnings in terminal.
If it doesn't work, please show the complete workflow from setting up a fresh environment up to getting this error.
Error emerged after the next call
.
call %gcc% -shared -s ^
%tempdir%\libmadx.obj ^
-L %MADXDIR%\lib ^
-lmadx -lptc -lgc-lib -lstdc++ -lgfortran ^
-lquadmath %pythondir%\python%py_ver%.dll -lmsvcr100 ^
-o %libdir%\libmadx.%file_tag%.pyd
Terminal log is attached.
P.S. Also there is a typo in Windows Building MAD-X guide, a colon in the end of cmake
statement:
cmake --build . --target install:
from cpymad.
P.S. Also there is a typo in Windows Building MAD-X guide, a colon in the end of
cmake
statement:cmake --build . --target install:
Thanks. Will fix.
Error emerged after the next
call
.call %gcc% -shared -s ^ %tempdir%\libmadx.obj ^ -L %MADXDIR%\lib ^ -lmadx -lptc -lgc-lib -lstdc++ -lgfortran ^ -lquadmath %pythondir%\python%py_ver%.dll -lmsvcr100 ^ -o %libdir%\libmadx.%file_tag%.pyd
Terminal log is attached.
It seems the newer MAD-X version might also require that you add -lDISTlib
after -lmadx
.
from cpymad.
It seems the newer MAD-X version might also require that you add
-lDISTlib
after-lmadx
.
I've tried that - no warnings. But I'm stuck at building a wheel:
(buildenv) C:\Users\skamarokhama\Anaconda3\envs\buildenv\cpymad>python setup.py bdist_wheel
C:\Users\skamarokhama\Anaconda3\envs\buildenv\lib\site-packages\setuptools\config\setupcfg.py:463: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
running bdist_wheel
running build
running build_py
running egg_info
writing src\cpymad.egg-info\PKG-INFO
writing dependency_links to src\cpymad.egg-info\dependency_links.txt
writing requirements to src\cpymad.egg-info\requires.txt
writing top-level names to src\cpymad.egg-info\top_level.txt
reading manifest file 'src\cpymad.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'utils*.py'
adding license file 'COPYING.rst'
writing manifest file 'src\cpymad.egg-info\SOURCES.txt'
running build_ext
building 'cpymad.libmadx' extension
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\skamarokhama\Anaconda3\envs\buildenv\MAD-X\dist\include -IC:\Users\skamarokhama\Anaconda3\envs\buildenv\include -IC:\Users\skamarokhama\Anaconda3\envs\buildenv\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcsrc/cpymad/libmadx.c /Fobuild\temp.win-amd64-cpython-39\Release\src/cpymad/libmadx.obj -std=gnu99
cl: command line warning D9002: ignoring unknown option "-std=gnu99"
libmadx.c
warning: I don't know what to do with 'runtime_library_dirs': ['C:\Users\skamarokhama\Anaconda3\envs\buildenv\MAD-X\dist\lib', 'C:\Users\skamarokhama\Anaconda3\envs\buildenv\MAD-X\dist\lib64']
error: don't know how to set runtime library search path for MSVC
from cpymad.
Looks like your setup uses a different temp path.
Try renaming the temp folder build/win-amd64-3.9
to build/win-amd64-cpython-3.9
.
Alternatively, if you need to rebuild, set before calling gcc:
set dir_tag=win-amd64-cpython-3.9
set tempdir=build\temp.%dir_tag%\Release\src\cpymad
from cpymad.
Great. I just updated it.
from cpymad.
Related Issues (20)
- Element redefinition and twiss HOT 5
- Add support to release Linux AArch64 wheels HOT 7
- EMIT module output is displayed with "delay" HOT 2
- TWISS: no beta0 found HOT 1
- New functions
- Can't run madx instance. TypeError HOT 5
- What is the preferred way to retrieve the command (string) with which an Element was created? HOT 3
- libmadx error installing on M1/M2 Apple Silicon HOT 7
- Pitfalls on compiling libmadx/cpymad on Linux HOT 5
- Proposal: specialize tables HOT 8
- Wheel for M1 apple? HOT 2
- Python 3.11 Wheels HOT 4
- Error building cpymad on M1 Apple Silicon - "-march=core2" not supported HOT 5
- call does not work when double slash is present in file path HOT 2
- access default beam HOT 1
- ValueError: TypeError: write() argument must be str HOT 4
- Python 3.12 wheels HOT 2
- Differences in cpymad `table.twiss` and madx `table(twiss, X, X)` when running `use` HOT 7
- Twiss at certain positions HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpymad.