API Installation Error on Mac - perl

I'm having trouble installing the ensembl API. I've been using the installation guide on the website. First I had a hard time getting DBI and DBD mySQL modules, but once I used perlbrew I had no issues. However when running ping I get the error message:
ERROR: Error detected when connecting to Ensembl!
Looks like you need to setup your PERL5LIB with the Ensembl API. Please consult http://www.ensembl.org/info/docs/api/api_installation.html
================================================================================
If the problem persists please send the following error message to helpdesk#ensembl.org
Can't locate Bio/EnsEMBL/Registry.pm in #INC (#INC contains: /Users/haleighmiller/perl5/perlbrew/perls/5.14.4/lib/site_perl/5.14.4/darwin-thread-multi-2level /Users/haleighmiller/perl5/perlbrew/perls/5.14.4/lib/site_perl/5.14.4 /Users/haleighmiller/perl5/perlbrew/perls/5.14.4/lib/5.14.4/darwin-thread-multi-2level /Users/haleighmiller/perl5/perlbrew/perls/5.14.4/lib/5.14.4 .) at ./ping_ensembl.pl line 117.
I've followed the installation guide to the best of my knowledge, and couldn't find anything else online to help. Any advice is much appreciated.

We can't see your code but it seems pretty clear what the problem is. You need to set up your environment as described under point #3 on the page you linked to that explains the API installation. Strangely, there is no build/install process, so you have to manually extend the PERL5LIB variable to point to the correct place. You can run echo $PERL5LIB to see where the interpreter will search for modules.
The error message you posted shows that you need to add the correct Ensembl directories for the script to work. An easy test is to run perl -MBio::EnsEMBL::Registry -e 1 at the command line. If it prints nothing, then everything is set correctly. If you see the same error message, that means the PERL5LIB variable is not set correctly.

Related

What causes error "Connection test failed: spawn npm; ENOENT" when creating new Strapi project with MongoDB?

I am trying to create a new Strapi app on Ubuntu 16.4 using MongoDB. After stepping through the tutorial, here: https://strapi.io/documentation/3.0.0-beta.x/guides/databases.html#mongodb-installation, I get the following error: Connection test failed: spawn npm; ENOENT
The error seems obvious, but I'm having issues getting to the cause of it. I've installed latest version of MongoDB and have ensured it is running using service mongod status. I can also connect directly using nc, like below.
$ nc -zvv localhost 27017
Connection to localhost 27017 port [tcp/*] succeeded!
Here is an image of the terminal output:
Any help troubleshooting this would be appreciated! Does Strapi perhaps log setup errors somewhere, or is there a way to get verbose logging? Is it possible the connection error would be logged by MongoDB somewhere?
I was able to find the answer. The problem was with using npx instead of Yarn. Strapi documentation states that either should work, however, it is clear from my experience that there is a bug when using npx.
I switched to Yarn and the process proceeded as expected without error. Steps were otherwise exactly the same.
Update: There is also a typo in Strapi documentation for yarn. They include the word "new" before the project name, which will create a project called new and ignore the project name.
Strapi docs (incorrect):
yarn create strapi-app new my-project
Correct usage, based on my experience:
yarn create strapi-app my-project
The ENOENT error is "an abbreviation of Error NO ENTry (or Error NO ENTity), and can actually be used for more than files/directories."
Why does ENOENT mean "No such file or directory"?
Everything I've read on this points toward issues with environment variables and the process.env.PATH.
"NOTE: This error is almost always caused because the command does not exist, because the working directory does not exist, or from a windows-only bug."
How do I debug "Error: spawn ENOENT" on node.js?
If you take the function that Jiaji Zhou provides in the link above and paste it into the top of your config/functions/bootstrap.js file (above module.exports), it might give you a better idea of where the error is occurring, specifically it should tell you the command it ran. Then run the command > which nameOfCommand to see what file path it returns.
"miss-installed programs are the most common cause for a not found command. Refer to each command documentation if needed and install it." - laconbass (from the same link, below Jiaji Zhou's answer)
This is how I interpret all of the above and form a solution. Put that function in bootstrap.js, then take the command returned from the function and run > which nameOfCommand. Then in bootstrap.js (you can comment out the function), put console.log(process.env.PATH) which will return a string of all the directories your current environment is checking for executables. If the path returned from your which command isn't in your process.env.PATH, you can move the command into a path, or try re-installing.

Understanding the error message: spdlog::spdlog_ex

I am aware this question is very specific. Nontheless, maybe s.o. can help:
I was trying to compile an open-source code today. (anyone, who's interested, that's the one.) The error message described below occurs after oai_hss -j $PREFIX/hss_rel14.json --onlyloadkey - having followed the step-by-step installation guide to this point.
After typing the aforementioned command in my terminal, the following error is thrown:
terminate called after throwing an instance of 'spdlog::spdlog_ex'
what(): Failed opening file logs/hss.log for writing: No such file or directory
Aborted (core dumped)
Allright, this sounds pretty severy (core dumped). I was searching google for a meaning of that error message. I came across this other github project. Apparently the spdlog class is trying to enable logging from wherever I run my program. And it throws an spdlog_ex error whenever the file it is trying to add to the registry (in this case logs/hss.log) already exists within this registry. So, I guess, the solution to my problem would be to find this registry and delete logs/hss.log. Does this make sense?
Question: Where the heck do I find this registry?
Maybe some background knowledge would be useful: I am trying to compile the open-source code within a VM that is running Ubuntu 18.04.3 LTS bionic with a 4.15.0-66-generic kernel.
I was searching the /tmp directory for a log folder already. There is none. Where else could it be?
open this file
sudo nano /usr/local/etc/oai/hss_rel14.json
you will see some config where you can find logs/hss.log
actually you have to change these 4 value to
logname: "/var/log/hss.log"
statlogname: "/var/log/hss_stat.log"
auditlogname: "/var/log/hss_audit.log"
ossfile: "~/openair-cn/etc/oss.json"
then use sudo touch to create these files
sudo touch /var/log/hss.log
sudo touch /var/log/hss_stat.log
sudo touch /var/log/hss_audit.log
for logname, statlogname, and auditlogname you can change it to whatever file you want but i like to put them together in /var/log folder.
for ossfile , the oss.json is actually in there.
hope this help

"Unable to find component name" on myodbc-installer of driver

Trying to follow the directions for installing the MySQL ODBC driver.
When I try to run:
myodbc-installer -a -d -n "MySQL ODBC 8.0 Driver" -t "Driver=/usr/local/lib/libmyodbc8w.so"
It says:
[ERROR] SQLInstaller error 6: Unable to find component name
I've found a handful of cases of people reporting this same message, e.g., here and here. Yet there seems to be no resolution.
Noticing the slight variations in the -n name string for the various drivers, I wondered if perhaps the name was something subtly different and the documentation hadn't been updated. But I used a hex editor to look in /usr/local/lib/libmyodbc8w.so and the literal string "MySQL ODBC 8.0 Driver" is in it.
There may be some instances of a name mismatch causing the problem (e.g. in one of the linked-to cases, they use -n "MySQL" instead of the prescribed -n "MySQL ODBC 5.3" from the notes).
However...in my case it was a matter of not using sudo. The error message is not very helpful in indicating that the problem could be a matter of privileges! :-/ But at the very top of the linked instruction page it says (emphasis mine):
To install the driver from a tarball distribution (.tar.gz file), download the latest version of the driver for your operating system and follow these steps, substituting the appropriate file and directory names based on the package you download (some of the steps below might require superuser privileges)
What's going on is that unixodbc has system-wide odbcinst.ini and odbc.ini. It is stated that you should not be editing these files directly, but they are edited via an API that unixodbc provides. That API is called by the MySQL helper utility called myodbc-installer:
The error message is delivered by this print_installer_error() routine
...which is called from add_driver() when the routine SQLInstallDriverExW() returns false
(Note: unixodbc on most platforms provides the (W)ide Character version of SQLInstallDriverEx(), but myodbc-installer defines its own SQLInstallDriverExW() if it is not available via a shim.)
This API apparently doesn't have a way of saying it can't get the necessary privileges to the files (in /usr/local/etc or perhaps just in /etc). So myodbc-installer is just parroting what it got. Sigh.

Call to undefined function mysql_connect after upgrade to Moodle 3.6 [duplicate]

This question already has answers here:
Fatal error: Uncaught Error: Call to undefined function mysql_connect()
(9 answers)
Closed 3 months ago.
I have ran aptitude install php5-mysql (and restarted MySQL/Apache 2), but I am still getting this error:
Fatal error: Call to undefined function mysql_connect() in /home/validate.php on line 21
phpinfo() says the /etc/php5/apache2/conf.d/pdo_mysql.ini file has been parsed.
In case, you are using PHP7 already, the formerly deprecated functions mysql_* were removed entirely, so you should update your code using the PDO-functions or mysqli_* functions instead.
If that's not possible, as a workaround, I created a small PHP include file, that recreates the old mysql_* functions with mysqli_*()-functions: fix_mysql.inc.php
I see that you tagged this with Ubuntu. Most likely the MySQL driver (and possibly MySQL) is not installed. Assuming you have SSH or terminal access and sudo permissions, log into the server and run this:
sudo apt-get install mysql-server mysql-client php5-mysql
If the MySQL packages or the php5-mysql package are already installed, this will update them.
UPDATE
Since this answer still gets the occasional click I am going to update it to include PHP 7. PHP 7 requires a different package for MySQL so you will want to use a different argument for the apt-get command.
# Replace 7.4 with your version of PHP
sudo apt-get install mysql-server mysql-common php7.4 php7.4-mysql
And importantly, mysql_connect() has been deprecated since PHP v5.5.0. Refer the official documentation here: PHP: mysql_connect()
Well, this is your chance! It looks like PDO is ready; use that instead.
Try checking to see if the PHP MySQL extension module is being loaded:
<?php
phpinfo();
?>
If it's not there, add the following to the php.ini file:
extension=php_mysql.dll
If someone came here with the problem of docker php official images, type below command inside the docker container.
$ docker-php-ext-install mysql mysqli pdo pdo_mysql
For more information, please refer to the link above How to install more PHP extensions section(But it's a bit difficult for me...).
Or this doc may help you.
https://docs.docker.com/samples/library/php/
I was also stuck with the same problem of undefined MySQL_connect().I tried to make changes in PHP.ini file but it was giving me the same error.
Then I came to this solution where I changed my code from depreciated php functions to new functions.
$con=mysqli_connect($host,$user,$password);
mysqli_select_db($con,dbname);
//To select the database
session_start(); //To start the session
$query=mysqli_query($con,your query);
//made query after establishing connection with database.
I hope this will help you .
This solution is correctly working for me .
EDIT:
If you upgrade form old php you need to apt-get install php7.0-mysql
Try:
<?php
phpinfo();
?>
Run the page and search for mysql. If not found, run the following in the shell and restart the Apache server:
sudo apt-get install mysql-server mysql-client php5-mysql
Also make sure you have all the following lines uncommented somewhere in your apache2.conf (or in your conf.d/php.ini) file, from
;extension=php_mysql.so
to
extension=php_mysql.so
In php.ini file
change this
;extension=php_mysql.dll
into
extension=php_mysql.dll
My guess is your PHP installation wasn't compiled with MySQL support.
Check your configure command (php -i | grep mysql). You should see something like '--with-mysql=shared,/usr'.
You can check for complete instructions at http://php.net/manual/en/mysql.installation.php. Although, I would rather go with the solution proposed by #wanovak.
Still, I think you need MySQL support in order to use PDO.
The question is tagged with ubuntu, but the solution of un-commenting the extension=mysqli.dll is specific to windows. I am confused here?!, anyways, first thing run <? php phpinfo ?> and search for mysql* under Configuration heading. If you don't see such a thing implies you have not installed or enabled php-mysql. So first install php-mysql
sudo apt get install php-mysql
This command will install php-mysql depending on the php you have already installed, so no worries about the version!!.
Then comes the unix specific solution, in the php.ini file un-comment the line
extension=msql.so
verify that msql.so is present in /usr/lib/php/<timestamp_folder>,
ELSE
extension=path/to/msql.so
Then finally restart the apache and mysql services, and you should now see the mysql section under Configrations heading in phpinfo page
I was getting this error because the project I was working on was developed on php 5.6 and after install, the project was unable to run on php7.1.
Just for anyone that uses Vagrant with ubuntu/nginx, in the nginx directory(/etc/nginx/), there is a directory named "sites-available" which contains a file named like the url configured for the vagrant maschine. In my case was homestead.app. Within this file there is a line that says something like
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
There you can change the php version to the desired for that particular site.
Googled this but wasnt really able to find a simple answer that said where to look and what to change.
Hope that this helps anyone.
Thanks.
If you are getting the error as
Fatal error: Call to undefined function mysql_connect()
Kindly login to the cPanel >> Click on Select Php version >> select the extension MYSQL
For CentOS 7.8 & PHP 7.3
yum install rh-php73-php-mysqlnd
And then restart apache/php.
(Windows mysql config)
Step 1 : Go To Apache Control Panel > Apache > Config > PHP.ini
Step 2 : Search in Notepad (Ctrl+F) For: ;extension_dir = "" (could be commented with a ;). Replace this line with: extension_dir = "C:\php\ext" (please do not you need to remove the ; on the beginning of the sentence).
Step 3 : Search For: extension=php_mysql.dll and remove the ; in the beginning.
Step 4 : Save and Restart You Apache HTTP Server. (On Windows this usually done via a UI)
That's it :)
If you get errors about missing php_mysql.dll you'll probably need to download this file from either the php.net site or the pecl.php.net. (Please be causius about where you get it from)
More info on PHP: Installation of extensions on Windows - Manual
There must be some syntax error. Copy/paste this code and see if it works:
<?php
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
die('Could not connect:' . mysql_error());
}
echo 'Connected successfully';
?
I had the same error message. It turns out I was using the msql_connect() function instead of mysql_connect().

Setting up wamp server for Perl

I am following the steps given in the following 2 links to setup wamp server for perl
https://shravanthimohan.wordpress.com/2011/11/26/configuring-perl-on-wamp/
http://chromicdesign.com/2009/05/setting-up-perl-for-wampp.html
However I am not able to run the perl scripts, the error says that the requested URL can not be found
I am also not able to run the command 'ppm repo add uwinnipeg'
I am getting the following error, NOT NULL constraint failed: repo.packlist_uri
Please help me out