{"id":45953,"library":"pyx","title":"PyX","description":"PyX is a Python package for the creation of PostScript, PDF, and SVG files, offering a high-level interface for drawing graphics, typesetting text, and generating vector graphics. Current version is 0.17, with an irregular release cadence; requires Python >=3.6.","status":"active","version":"0.17","language":"python","source_language":"en","source_url":"https://sourceforge.net/projects/pyx/","tags":["graphics","vector","postscript","pdf","svg"],"install":[{"cmd":"pip install pyx","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Common import for creating canvases.","symbol":"canvas","correct":"from pyx import canvas"},{"note":"Common import for path operations.","symbol":"path","correct":"from pyx import path"},{"note":"Common import for color handling.","symbol":"color","correct":"from pyx import color"},{"note":"Decorations module is 'deco' not 'decorations'.","wrong":"from pyx import decorations","symbol":"deco","correct":"from pyx import deco"},{"note":"Transformation module is 'trafo' not 'transform'.","wrong":"from pyx import transform","symbol":"trafo","correct":"from pyx import trafo"}],"quickstart":{"code":"from pyx import canvas, path, color\nc = canvas.canvas()\nc.stroke(path.line(0, 0, 2, 0), [color.rgb.blue])\nc.writePDFfile('output')\nprint('PDF generated')","lang":"python","description":"Basic example: draw a blue line and write to PDF."},"warnings":[{"fix":"Check docs at https://pyx-project.org/ (though may be outdated).","message":"PyX version 0.17 is a stub release; the API may have subtle differences from earlier versions. Always refer to the official documentation for your installed version.","severity":"gotcha","affected_versions":"0.17"},{"fix":"Use c.writePDFfile('output') not c.writePDFfile('output.pdf').","message":"The 'canvas.writePDFfile' method writes to a file, but the extension is automatically appended; do not include '.pdf' in the filename argument.","severity":"gotcha","affected_versions":"all"},{"fix":"Use alternative approaches or contribute updates.","message":"The modules 'epsfile' and 'pdfreader' are deprecated and may be removed in future versions.","severity":"deprecated","affected_versions":">0.15"}],"env_vars":null,"search_vec":"'0.17':34 '3.6':42 'cadenc':39 'creation':9 'current':31 'draw':23 'file':15 'generat':28 'graphic':24,30,43 'high':19 'high-level':18 'interfac':21 'irregular':37 'level':20 'offer':16 'packag':6 'pdf':12,46 'postscript':11,45 'python':5,41 'pyx':1,2 'releas':38 'requir':40 'svg':14,47 'text':26 'typeset':25 'vector':29,44 'version':32","created_at":"2026-06-07T12:57:32.670140+00:00","updated_at":"2026-06-07T12:57:32.670140+00:00","problems":[{"fix":"Run 'pip install pyx' and ensure you are using the same Python interpreter.","cause":"PyX is not installed or installed in a different Python environment.","error":"ModuleNotFoundError: No module named 'pyx'"},{"fix":"Use 'from pyx import canvas'. If still failing, reinstall PyX with 'pip install --upgrade pyx'.","cause":"Incorrect import path or PyX version mismatch.","error":"ImportError: cannot import name 'canvas' from 'pyx'"},{"fix":"Use c.writePDFfile('output') without '.pdf' extension.","cause":"Passing file extension in the filename argument; writePDFfile automatically adds '.pdf'.","error":"TypeError: writePDFfile() takes 1 positional argument but 2 were given"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}