I'm trying to use cvxpy on a pythonanywhere server, the installation was ok, no errors however when i want to import cvpxy as cp, i have an error, help me please
the error :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/padacore/.virtualenvs/env/lib/python3.7/site-packages/cvxpy/__init__.py", line 18, in <module>
from cvxpy.atoms import *
File "/home/padacore/.virtualenvs/env/lib/python3.7/site-packages/cvxpy/atoms/__init__.py", line 17, in <module>
from cvxpy.atoms.cummax import cummax
File "/home/padacore/.virtualenvs/env/lib/python3.7/site-packages/cvxpy/atoms/cummax.py", line 17, in <module>
from cvxpy.atoms.atom import Atom
File "/home/padacore/.virtualenvs/env/lib/python3.7/site-packages/cvxpy/atoms/atom.py", line 21, in <module>
from cvxpy.expressions.constants import Constant
File "/home/padacore/.virtualenvs/env/lib/python3.7/site-packages/cvxpy/expressions/constants/__init__.py", line 17, in <module>
from .constant import Constant
File "/home/padacore/.virtualenvs/env/lib/python3.7/site-packages/cvxpy/expressions/constants/constant.py", line 22, in <module>
from scipy.sparse.linalg import eigsh
File "/home/padacore/.virtualenvs/env/lib/python3.7/site-packages/scipy/sparse/linalg/__init__.py", line 111, in <module>
from .isolve import *
File "/home/padacore/.virtualenvs/env/lib/python3.7/site-packages/scipy/sparse/linalg/isolve/__init__.py", line 4, in <module>
from .iterative import *
File "/home/padacore/.virtualenvs/env/lib/python3.7/site-packages/scipy/sparse/linalg/isolve/iterative.py", line 8, in <module>
from . import _iterative
ImportError: /home/padacore/.virtualenvs/env/lib/python3.7/site-packages/scipy/sparse/linalg/isolve/../../../../scipy.libs/libopenblasp-r0-085ca80a.3.9.so: cannot read file data
It could be something to do with Atom, try switching to another editor. I recommend PyCharm or VSCode. If you're choosing VSCode, install these extensions: Python, PyLance, and Jupyter.
If you don't like VSCode's default themes, and miss Atom's One Dark, then there's an extension just for that! Just search for it, and you'll find it!
EDIT: If it wasn't something to do with Atom, maybe install an older version of cvxpy
Related
After installing pandas and some other dependencies, this error occurred when I ran my program.
Traceback (most recent call last):
File "/home/nielson-scientific/schreiber-uv-led-sterilization-system/src/main.py", line 8, in <module>
from Tabs.SystemHistory import SystemHistory
File "/home/nielson-scientific/schreiber-uv-led-sterilization-system/src/Tabs/SystemHistory.py", line 9, in <module>
from Utils.CSV import CsvData
File "/home/nielson-scientific/schreiber-uv-led-sterilization-system/src/Utils/CSV.py", line 7, in <module>
import pandas as pd
File "/home/nielson-scientific/.local/lib/python3.9/site-packages/pandas/__init__.py", line 22, in <module>
from pandas.compat import is_numpy_dev as _is_numpy_dev
File "/home/nielson-scientific/.local/lib/python3.9/site-packages/pandas/compat/__init__.py", line 15, in <module>
from pandas.compat.numpy import (
File "/home/nielson-scientific/.local/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py", line 4, in <module>
from pandas.util.version import Version
File "/home/nielson-scientific/.local/lib/python3.9/site-packages/pandas/util/__init__.py", line 1, in <module>
from pandas.util._decorators import ( # noqa:F401
File "/home/nielson-scientific/.local/lib/python3.9/site-packages/pandas/util/_decorators.py", line 14, in <module>
from pandas._libs.properties import cache_readonly # noqa:F401
File "/home/nielson-scientific/.local/lib/python3.9/site-packages/pandas/_libs/__init__.py", line 13, in <module>
from pandas._libs.interval import Interval
File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 48 from C header, got 40 from PyObject
I have tried upgrading the version of numpy and that printed out new different error saying numpy import error.
nielson-scientific#pi:~/schreiber-uv-led-sterilization-system $ python3 src/main.py
Traceback (most recent call last):
File "/home/nielson-scientific/schreiber-uv-led-sterilization-system/src/main.py", line 8, in <module>
from Tabs.SystemHistory import SystemHistory
File "/home/nielson-scientific/schreiber-uv-led-sterilization-system/src/Tabs/SystemHistory.py", line 9, in <module>
from Utils.CSV import CsvData
File "/home/nielson-scientific/schreiber-uv-led-sterilization-system/src/Utils/CSV.py", line 7, in <module>
import pandas as pd
File "/home/nielson-scientific/.local/lib/python3.9/site-packages/pandas/__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.9 from "/usr/bin/python3"
* The NumPy version is: "1.22.4"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: libcblas.so.3: cannot open shared object file: No such file or directory
Anyone have Idea how to fix this?
I am struggling because of the error
AttributeError: module 'pandas' has no attribute 'core'
since quite a long time please refer the output of "import pandas" below. I have searched for this error on the net and searched at many places tried many things but was unable to resolve it. The problem was the solutions provided were more realted to other operating systems like Mac and Linux while I am using Windows 7 Professional.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\__init__.py", line 42, in <module>
from pandas.core.api import *
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\api.py", line 10, in <module>
from pandas.core.groupby.groupby import Grouper
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\groupby\__init__.py", line 2, in <module>
from pandas.core.groupby.groupby import (
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\groupby\groupby.py", line 49, in <module>
from pandas.core.frame import DataFrame
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\frame.py", line 74, in <module>
from pandas.core.series import Series
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\series.py", line 66, in <module>
import pandas.core.ops as ops
AttributeError: module 'pandas' has no attribute 'core'
Please do ask if you need any other details. I will be really gratified if you help me through this.
Thankyou
P.S if you can suggest a solution which does not use internet using terminal such as in case of "pip install pandas" as the company's network access is restricted. So, I installed all the dependencies of pandas through whl files which are downloadable through the access the company has provided.
Edit: The first time I execute pandas it shows and rest it shows the error shown above
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\__init__.py", line 42, in <module>
from pandas.core.api import *
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\api.py", line 10, in <module>
from pandas.core.groupby.groupby import Grouper
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\groupby\__init__.py", line 2, in <module>
from pandas.core.groupby.groupby import (
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\groupby\groupby.py", line 49, in <module>
from pandas.core.frame import DataFrame
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\frame.py", line 74, in <module>
from pandas.core.series import Series
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\series.py", line 3978, in <module>
Series._add_series_or_dataframe_operations()
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\generic.py", line 8891, in _add_series_or_dataframe_operations
from pandas.core import window as rwindow
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\window.py", line 36, in <module>
import pandas._libs.window as _window
ImportError: DLL load failed: The specified module could not be found.
conda upgrade --all
Upgrade your library and restart your notebook.This will do the work.
I somehow messed up my python and am running out of ideas how to fix it. I am using Python 2.7.6. on a Windows computer. Basically anything connected to xml stopped working. Meaning: it worked fine before, then the console crashed, and now I get the error described.
When I write
pip install numpy
in the console I get the following error:
Traceback (most recent call last):
File "C:\Python27\Scripts\pip-script.py", line 9, in <module>
load_entry_point('pip==1.5.2', 'console_scripts', 'pip')()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 351, in load_entry
_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2363, in load_entr
y_point
return ep.load()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2088, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "C:\Python27\lib\site-packages\pip\__init__.py", line 11, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "C:\Python27\lib\site-packages\pip\vcs\subversion.py", line 4, in <module
>
from pip.index import Link
File "C:\Python27\lib\site-packages\pip\index.py", line 18, in <module>
import html5lib
File "C:\Python27\lib\site-packages\html5lib\__init__.py", line 16, in <module
>
from .html5parser import HTMLParser, parse, parseFragment
File "C:\Python27\lib\site-packages\html5lib\html5parser.py", line 6, in <modu
le>
from . import inputstream
File "C:\Python27\lib\site-packages\html5lib\inputstream.py", line 10, in <mod
ule>
from . import utils
File "C:\Python27\lib\site-packages\html5lib\utils.py", line 8, in <module>
import xml.etree.ElementTree as default_etree
ImportError: No module named etree.ElementTree
What I did so far: I tried to reinstall the xml package (which was suggested in the forum). I also installed Anaconda with various environments. There, the problem is visible when I want to use packages like openpyxl, which gives me a similar error message:
Traceback (most recent call last):
File "HU_calc.py", line 1, in <module>
import openpyxl as px
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\__init__.py", line 29
, in <module>
from openpyxl.workbook import Workbook
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\workbook\__init__.py"
, line 5, in <module>
from .workbook import Workbook
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\workbook\workbook.py"
, line 7, in <module>
from openpyxl.worksheet import Worksheet
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\worksheet\__init__.py
", line 4, in <module>
from .worksheet import Worksheet
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\worksheet\worksheet.p
y", line 35, in <module>
from openpyxl.cell import Cell
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\cell\__init__.py", li
ne 4, in <module>
from .cell import Cell, WriteOnlyCell
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\cell\cell.py", line 4
5, in <module>
from openpyxl.styles import numbers, is_date_format
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\styles\__init__.py",
line 5, in <module>
from .alignment import Alignment
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\styles\alignment.py",
line 6, in <module>
from openpyxl.descriptors import Bool, MinMax, Min, Alias, NoneSet
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\descriptors\__init__.
py", line 5, in <module>
from .sequence import Sequence
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\descriptors\sequence.
py", line 5, in <module>
from openpyxl.xml.functions import Element
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\xml\functions.py", li
ne 28, in <module>
from xml.etree.cElementTree import iterparse
ImportError: No module named etree.cElementTree
This is especially confusing to me, as I thought Anaconda would create a python environment completely isolated from the Windows one. I feel like I am missing something very obvious. If there's anything missing/unclear in my question, I'll fix that as soon as possible.
I'd be very grateful for every advice.
Looks like you have a python script named xml.py. Rename that and it should work.
I'm trying to run a script my client has provided, but I can't get it to start; it seems certainly a setup question on my machine, as it works for them. I started by installing WinPython from http://scipy.org/, but I'm now getting the following traceback:
Traceback (most recent call last):
File "pyconsole.py", line 18, in <module>
import cocomo
File "pyconsole\cocomo.py", line 13, in <module>
import grupple
File "pyconsole\grupple.py", line 4, in <module>
import matplotlib.mlab as mlab
File "C:\Users\lab\AppData\Roaming\Python\Python27\site-packages\matplotlib\__init__.py", line 134, in <module>
from matplotlib.rcsetup import (defaultParams,
File "C:\Users\lab\AppData\Roaming\Python\Python27\site-packages\matplotlib\rcsetup.py", line 19, in <module>
from matplotlib.colors import is_color_like
File "C:\Users\lab\AppData\Roaming\Python\Python27\site-packages\matplotlib\colors.py", line 52, in <module>
import numpy as np
File "C:\Users\lab\AppData\Roaming\Python\Python27\site-packages\numpy\__init__.py", line 137, in <module>
import add_newdocs
File "C:\Users\lab\AppData\Roaming\Python\Python27\site-packages\numpy\add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "C:\Users\lab\AppData\Roaming\Python\Python27\site-packages\numpy\lib\__init__.py", line 13, in <module>
from polynomial import *
File "C:\Users\lab\AppData\Roaming\Python\Python27\site-packages\numpy\lib\polynomial.py", line 17, in <module>
from numpy.linalg import eigvals, lstsq, inv
File "C:\Users\lab\AppData\Roaming\Python\Python27\site-packages\numpy\linalg\__init__.py", line 48, in <module>
from linalg import *
File "C:\Users\lab\AppData\Roaming\Python\Python27\site-packages\numpy\linalg\linalg.py", line 23, in <module>
from numpy.linalg import lapack_lite
ImportError: DLL load failed: The specified module could not be found.
I'm not confident in interpreting Python tracebacks, but it seems that "lapack_lite" is missing? Searching around a bit seems surprisingly unhelpful; the best I've seemed to determine is that it is part of numpy? But that's odd, as the reason I started with the WinPython distribution is that the numpy stack is pre-installed, and that is the easiest way to get started with that.
What am I missing?
Thanks!
i think the easiest way under Windows would be to simply install Anaconda (this takes care of all the dependencies of Numpy and Scipy). You can download it from here:
https://www.continuum.io/downloads
This way you dont have to scroll through pages of Documentation on how to get all dependencies right.
Kind regards
Johann
When I try to use this command line to run this python code:
~/Tools/find_differential_primers/utils python stitch_six_frame_stops.py seq.fa
Error code will be displayed as followed. could you help me solve this problem.
Traceback (most recent call last):
File "stitch_six_frame_stops.py", line 55, in <module>
import matplotlib
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-macosx-10.8 intel.egg/matplotlib/__init__.py", line 129, in <module>
from matplotlib.cbook import is_string_like
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/cbook.py", line 28, in <module>
import numpy as np
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/__init__.py", line 140, in <module>
from . import add_newdocs
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/lib/__init__.py", line 6, in <module>
from .type_check import *
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/core/__init__.py", line 6, in <module>
from . import multiarray
ImportError: /usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/core/multiarray.so: invalid ELF header
You are trying to use a .so file in Mac OSX! .so files work on Linux; Mac OSX works with .dynld files. You probably may want to verify your NumPy Installation.
Assuming you are using OSX Lion, please see here for how to install NumPy on the OSX.