Why can't solcx find or use the compiler already installed? - python

I have installed solcx and installed the solidity compiler via the respective methods
pip install py-solc-x
sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solc
However visual studio can not find my solidity compiler
When I run solc --version within my normal terminal I get
solc, the solidity compiler commandline interface Version: 0.8.18+commit.87f61d96.Linux.g++
However when i run
compiled_contract = compile_files([{"path": filename, "content": contract_source_code}])
The error message i get is
which: no solc in (/home/{USER}/Desktop/Ethernaut/venv/bin:/home/{USER}/.nvm/versions/node/v19.3.0/bin:/app/bin:/app/bin:/app/bin:/usr/bin:/home/{USER}/.var/app/com.visualstudio.code/data/node_modules/bin:/home/{USER}/.foundry/bin)
Even though when I run which solc it outputs the following (normal desktop terminal):
/usr/bin/solc
When I run solc within visual studio terminal it says the following:
bash: solc: command not found
I thought it was a permission issue and I changed the owner of the solc binary within usr/bin however that still not resolved the issue

Seems to be an issue regarding flatpak install of vs code. Reinstalled using a different packet manager.

Related

YouCompleteMe: compile problem ycm core library not detected. VIM. Linux MInt

The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). YCM core library not detected; you need to compile YCM before using it.
I tried to compile ycm file using:
https://github.com/todaygood/go_repo/issues/5
Cannot run Python script using sudo
https://vimawesome.com/plugin/youcompleteme#linux-64-bit
and 2 more sources which include same info
but my problem starts when i try to run
python3 install.py
in terminal
Error:This script should not be run with sudo.
I have virtualenv, i have cmake, i tried to ran it in my env, i tried using different commands using pip, pip3, python, python3, sudo + <--(,,,,). Of course i tried to do it using root.
YouCompleteMe build example with a clean Ubuntu 20.04.3, installed/updated 10 days ago
sudo apt install build-essential cmake vim-nox \
python3-dev golang openjdk-11-jdk rust-all npm
## in /home/[name]/tmp/
git clone https://github.com/ycm-core/YouCompleteMe.git
cd YouCompleteMe/
git submodule update --init --recursive
./install.py --all
Generating ycmd build configuration...OK
Compiling ycmd target: ycm_core...OK
Building regex module...OK
Building watchdog module...OK
Installing Omnisharp for C# support...OK
Building gopls for go completion...OK
Setting up Tern for JavaScript completion...OK
Installing rust-analyzer for Rust support...OK
Installing jdt.ls for Java support...OK
Setting up TSserver for TypeScript completion...OK
Setting up Clangd completer...OK
(No issues with other OS´s either.)

Tensorflow installation on Ubuntu permission error

I installed virtual box on my Windows 10 machine and installed Ubuntu on the virtual box. Then I installed Tensorflow on Ubuntu by following this instructions from Tensorflow.org. Everything went well including pip install and stuff but when I run $ pip install tensorflow I run into permission error as the screenshot shows.
This error is not described in the install errors listed on Tensorflow.org at the bottom of that step 2. How do I solve that?
It seems like you need elevated permissions to write to /usr/local/lib.
Executing sudo pip install tensorflow will install tensorflow using root privileges.
(Also, your problem is with Ubuntu, not with Windows 10! Your host system has no influence in the permissions of the guest.)
As is with most Linux flavors, if you run into permission related errors just add sudo in front of the command and enter the password to confirm you have admin privileges. In this case simply type sudo pip istall tensorflow. But since the ubuntu also comes with the latest 3.N version of python it is better to do sudo pip3 install tensorflow.
I ran into the same problem and found the answer on Github.
The mistake I make was that Anaconda was installed with sudo ./<install script> instead of the correct command bash <install script> as noted on the download page. This made some files root-owned.

How to fix "Can't find local Berkeley DB" error?

I'm trying to install scrapy-deltafetch in a virtual-environment (as described here) on my new raspberry pi 3 with Raspbian.
When I'm running pip install scrapy-deltafetch in my virtualenv, I'm getting something like this:
python setup.py egg_info:
Can't find a local Berkeley DB installation
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ib6d93/bsddb3/
However when I'm running sudo pip install scrapy-deltafetch outside of my virtual-environment everything works fine.
Does anybody has an idea of how to install scrapy-deltafetch in the virtualenvironment?
Your system is missing Berkeley DB, which is used by DeltaFetch to store requests data.
So, first install Berkeley DB in your system (found this tutorial in a quick search).
After that, you have to install the bsddb3 Python package (you can follow the instructions from this answer).
Edit (2020):
This should work:
$ sudo apt install libdb-dev
$ pip install bsddb3
In case of my Ubuntu 18.04 missing system library is called libdb-dev.
> sudo apt-get install libdb-dev
This fixed the problem for me.

Physically uninstalled Python 3.4 to make pip3 install "requests" package to Python 3.5, how do I fix the mess that ensued?

I am using Ubuntu 14.04
I wanted to install package "requests" to use in python 3.5, so I installed it using pip3. I could see it in /usr/lib/python3.4, but while trying to actually execute scripts with Python 3.5 I always got "ImportError: No module named 'requests'"
OK, so I figured, perhaps that's because the package is not in python3.5 but in python3.4. Therefore, I tried to uninstall and install i again, but it just kept popping up where I didn't want it (not to mention, when I run apt-get remove pip3-requests, it actually removed pip3 for me as well lol). Therefore, I tried physically removing python3.4 from usr/lib and usr/local/lib in order to try and see if maybe pip3 was confused and installed packages in wrong directories.
I'm afraid it was not a good idea... when I now run e.g.
sudo pip3 install reqests
I get the following error:
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Is there any way to fix this now? And to actually use requests package?
When I use
sudo apt-get install python3-pip
It works and starts unpacking etc. but then I get a long error that starts with:
Setting up python3.4 (3.4.3-1ubuntu1~14.04.3)
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted
dpkg: error processing package python3.4 (--configure):
subprocess installed post-installation script returned error exit status 134
dpkg: dependency problems prevent configuration of python3:
(...)
and ends with
python3 depends on python3.4 (>= 3.4.0-0~); however:
Package python3.4 is not configured yet.
dpkg: error processing package python3-wheel (--configure):
dependency problems - leaving unconfigured
E: Sub-process /usr/bin/dpkg returned an error code (1)
First of all, it is a very bad idea to remove your system Python 3 in Ubuntu (which 3.4 is in recent
subrevisions of Trusty LTS). That is because it is a vital part of the system. If you run the command apt-cache rdepends python3, you'd see that packages such as ubuntu-minimal, ubuntu-release-upgrader-core, lsb-release, lsb-core, ubuntu-core-libs and so on, all depend on Ubuntu's version of Python 3 being installed (and this is the python3.4 in Ubuntu 14.04.4). If you force-remove python 3.4 by hand, you've ruined your system.
It might very well be
that you now have to reinstall the whole operating system, unless you manage to reinstall all the system
.deb packages that put data in /usr/lib/python3.4.
And especially so if you do it with force. It can make your system even unbootable, so do not reboot that
computer before you've successfully reinstalled Python 3... actually I am not sure how to do it safely since
it seems you've forcefully removed all system dependencies from the /usr/lib)
You should try to reinstall python3.4
sudo apt-get install --reinstall python3.4
But now the bigger problem is that you've still missing all sorts of dependencies for your system programs.
Do note that pip also should be available as a module. Thus to ensure that you install for Python 3.5,
you can do
sudo python3.5 -mpip install requests
The pip3 is a wrapper for a pip that installs to the system Python 3 version (3.4 in your case).
Ubuntu 14.04LTS uses the trusty package list. That repository comes with Python 3.4.0-0ubuntu2. So the pip contained in python3-pip belongs to that version: 3.4.
As such, when using Python 3.5, packages installed using Python 3.4 and that version’s pip will not be available.
I don’t know how you installed Python 3.5 on your system, but you should use that way to install pip for that version as well. If you compiled it from source yourself, you should see the install instructions for pip on how to get it installed for Python 3.5.
Open a text-only virtual console by using the keyboard shortcut Ctrl + Alt + F3.
At the login: prompt type your username and press Enter.
At the Password: prompt type your user password and press Enter.
Reinstall the default Python 3 version by running the following command:
sudo apt install python3-all
Switch out of the virtual console and return to your desktop environment by pressing the keyboard shortcut Ctrl+Alt+F7. In Ubuntu 17.10 and later press the keyboard shortcut Ctrl+Alt+F2 to exit from the virtual console.
After you have installed the default Python 3 version, you need to get back your default Ubuntu desktop system. In order to avoid messing something up, do it in the following order:
First install the terminal from the console using the command: sudo apt install gnome-terminal. If you can't install gnome-terminal at all, skip this step and go to step 2.
Return to your desktop and open the terminal using the keyboard shortcut Ctrl + Alt + T. From the terminal install the Ubuntu Software Center using the command:
sudo apt install software-center
In Ubuntu 16.04 and later run this command instead to reinstall the default Software application:
sudo apt install gnome-software
If you still can't open the terminal, run the same command from the console instead. If you can't install the default software application at all, skip this step and go to step 3.
Open the terminal and try to open the Ubuntu Software Center from the terminal by running the appropriate command, either: software-center or gnome-software. From the Ubuntu Software Center install the Ubuntu desktop system or else open the terminal (or the console) and install the Ubuntu desktop system by running the command: sudo apt install ubuntu-desktop.

Installing Python3 on Mac OS X Yosemite

I'm trying to install Python3 on a Mac OS X Yosemite, and did that by running the following command:
$ brew install python3
When I tried that, I got the following error:
clang: error: unable to find utility "clang", not a developer tool or in PATH
otool: error: unable to find utility "otool", not a developer tool or in PATH
Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool
How can I fix this issue?
Thanks.
Try brew update and then brew doctor first. The doctor diagnoses common issues.
Seems something's wrong with your Xcode/Command Line Tools. This answer might be helpful.
I would highly recommend using the anaconda distribution, in particular miniconda.
For OSX Yosemite, this is a link to the Python 3.4 64-bit installer.
After downloading the application, open a terminal window, navigate to where you downloaded the app (e.g. cd ~/Downloads) and type:
bash Miniconda-latest-MacOSX-x86_64.sh
Now close and re-open your terminal window for the changes to take effect.
To test your installation, enter the command conda list from the terminal. If installed correctly, you will see a list of packages that were installed.
From here, you should be able to follow the on-screen instructions. If you get lost, you can refer to their installation guide.
After installing conda, you need to create an environment. To install an new environment named py3 with Python 3:
conda create --name py3 python=3
To activate this environment:
source activate py3
Here, I normally install iPython, iPython notebook and pyqt:
conda install ipython, ipython-notebook, pyqt
Now, to activate an ipython shell from within your environment:
ipython qtconsole
Although this reply does not attempt fix the homebrew issue, it answers the question of how to install Python3 on Mac OS X Yosemite.
Open Terminal and
[Try]: brew update
[or Homebrew Install]: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
(code source found at https://brew.sh/)
Make sure processes finish, and then [Re-Try]: brew install python3
For me, I ran brew doctor which said
Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
pandoc
heroku
numpy
unbound
python#3.8
So I ran brew link python#3.8
And immediately after, python3 suddenly works!

Categories